Figure 39: New Resource added to strings.xml If you look into the file (Figure 40), "activity_table_layout.xml" the attribute of the is now pointing to the new string android:text TextView resource through this syntax @string/sign_in. Figure 40: TextView points to the new String Resource The outcome of this is shown in Figure 41. Figure 41: TextView new Value Learning 7: When you need a new text string, do not hard code it. Instead, you should create a new string resource that takes that text string as value. You will then reference this string resource in the XML or in code whenever you need to use text string on any UIs. That is reusability and maintainability at its best. You should always visit Figures 37 to 41 for reference. You will continue to the UI The completed UI TableLayout on your own. should look like that in Figure 42. Beside the widget for the "Sign Large Text In..." label, Drag and drop two onto the UI and change Medium Text Widgets properties to "Email" and "Password" respectively. (Follow text the steps from Figures 37 to 40.) Drag and drop an and a (which are E-mail Password Text Fields actually onto the UI and insert the words "Email" and EditText Views) "Password" into their respective properties. You should use the hint two string resources that you have created above. How? In the pane, click in the text field beside the property, a Properties hint button that marked "..." will appear, then click on it to bring out the window (similar to what you see in Figure 37). This Resources time, you should see the two strings you created above for "Email"
Figure 39: New Resource added to strings.xml If you look into the "activity_table_layout.xml" file (Figure 40), the android:text attribute of the TextView is now pointing to the new string resource through this syntax @string/sign_in. Figure 40: TextView points to the new String Resource The outcome of this is shown in Figure 41. Figure 41: TextView new Value Learning 7: When you need a new text string, do not hard code it. Instead, you should create a new string resource that takes that text string as value. You will then reference this string resource in the XML or in code whenever you need to use text string on any UIs. That is reusability and maintainability at its best. You should always visit Figures 37 to 41 for reference. You will continue to the TableLayout UI on your own. The completed UI should look like that in Figure 42. Beside the Large Text widget for the "Sign In..." label, Drag and drop two Medium Text Widgets onto the UI and change text properties to "Email" and "Password" respectively. (Follow the steps from Figures 37 to 40.) Drag and drop an E-mail and a Password Text Fields (which are actually EditText Views) onto the UI and insert the words "Email" and "Password" into their respective hint properties. You should use the two string resources that you have created above. How? In the Properties pane, click in the text field beside the hint property, a button that marked "..." will appear, then click on it to bring out the Resources window (similar to what you see in Figure 37). This time, you should see the two strings you created above for "Email"
Android%20UI%20and%20Controls%20New.docx