Question
Requirements: 1. Give your app a title. 2. Instead of The Selected position:6 , display the title of the app. 3. Keep the thumbnail, remove
Requirements:
1. Give your app a title.
2. Instead of The Selected position:6 , display the title of the app.
3. Keep the thumbnail, remove the Photo-n under it. Also change the background color of the thumbnail.
4.When click on the thumbnail, the high resolution image should be displayed. Below the high resolution image, display the photo number and a short photo caption at different rows.
5. Create the captions for the photo in string.xml file.
You can use getResources().getText(R.string.string_name) to reference it.
See
https://developer.android.com/guide/topics/resources/accessing-resources.html
Original Source Code:
MainActivity.java package com.example.horizontalscroll; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends Activity { //GUI controls TextView txtMsg; ViewGroup scrollViewgroup; //large image frame for displaying high-quality selected image ImageView imageSelected; //each frame in the ScrollView has [icon, caption] ImageView icon; TextView caption; //frame captions String[] items = {"Photo-00", "Photo-01", "Photo-02", "Photo-03", "Photo-04", "Photo-05", "Photo-06", "Photo-07", "Photo-08", "Photo-09", "Photo-10", "Photo-11", "Photo-12", "Photo-13", "Photo-14", "Photo-15", "Photo-16", "Photo-17", "Photo-18", "Photo-19", "Photo-20", "Photo-21", "Photo-22", "Photo-23", "Photo-24", "Photo-25", "Photo-26", }; //frame-icons ( 100X100 thumbnails ) Integer[] thumbnails = { R.drawable.small_pic00, R.drawable.small_pic01, R.drawable.small_pic02 ,R.drawable.small_pic03, R.drawable.small_pic04, R.drawable.small_pic05 ,R.drawable.small_pic06, R.drawable.small_pic07, R.drawable.small_pic08 ,R.drawable.small_pic09, R.drawable.small_pic10, R.drawable.small_pic11 ,R.drawable.small_pic12, R.drawable.small_pic13, R.drawable.small_pic14 ,R.drawable.small_pic15, R.drawable.small_pic16, R.drawable.small_pic17 ,R.drawable.small_pic18, R.drawable.small_pic19, R.drawable.small_pic20 ,R.drawable.small_pic21, R.drawable.small_pic22, R.drawable.small_pic23 ,R.drawable.small_pic24, R.drawable.small_pic25, R.drawable.small_pic26 }; //hi-resolution images Integer[] largeImages = { R.drawable.large_pic00, R.drawable.large_pic01, R.drawable.large_pic02 ,R.drawable.large_pic03, R.drawable.large_pic04, R.drawable.large_pic05 ,R.drawable.large_pic06, R.drawable.large_pic07, R.drawable.large_pic08 ,R.drawable.large_pic09, R.drawable.large_pic10, R.drawable.large_pic11 ,R.drawable.large_pic12, R.drawable.large_pic13, R.drawable.large_pic14 ,R.drawable.large_pic15, R.drawable.large_pic16, R.drawable.large_pic17 ,R.drawable.large_pic18, R.drawable.large_pic19, R.drawable.large_pic20 ,R.drawable.large_pic21, R.drawable.large_pic22, R.drawable.large_pic23 ,R.drawable.large_pic24, R.drawable.large_pic25, R.drawable.large_pic26 }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //bind GUI controls to Java classes txtMsg = (TextView) findViewById(R.id.txtMsg); imageSelected = (ImageView) findViewById(R.id.imageSelected); // this layout goes inside the HorizontalScrollView scrollViewgroup = (ViewGroup) findViewById(R.id.viewgroup); for (int i = 0; iActivity_main.xml1:30 Selected position: 6 Photo-6 Photo-7 Photo-8 Pho 1:30 Selected position: 6 Photo-6 Photo-7 Photo-8 Phoframe_icon_caption.xml
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started