Learn Android Studio by Adam Gerber & Clifton Craig

Learn Android Studio by Adam Gerber & Clifton Craig

Author:Adam Gerber & Clifton Craig
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Here you’ve added member fields for each of the TextView and EditText components. The onCreate() method starts by finding each view component and saving them in the individual member variables. Next you find the parent of the name label and change its background color to light blue. Android Studio sports a unique feature that decorates the left-hand gutter with a square, illustrating the color referenced on this line. These squares also appear on other lines that reference color resources. You then change the text appearance of each TextView, making the name stand out with a large appearance. You are using predefined styles from within the android.R class, which includes references to all available resources from the Android SDK. Each remaining TextView is also updated to use either a medium or an inverse appearance. Finally, you disable the description EditText to prevent modification of its contents. You also set its background to white while changing the text color to black.

To try our new ProfileActivity and layout, you have to define it in AndroidManifest.xml and link it to MainActivity. Open the manifest and add a tag for our ProfileActivity under the MainActivity definition:

<activity

android:name=".ProfileActivity"

android:label="@string/app_name" />

Next return to MainActivity and override the onListItemClick() method with the following code to create a new intent around the ProfileActivity class, and start the activity. Run the example and try clicking any list item to bring up its profile. See Figure 8-26.

Figure 8-26.New layout with buttons and EditText



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.