8.4.7. DetailsFragment’s Layout: fragment_details.xml

When the user touches a contact in the MainActivity, the app displays the DetailsFragment (Fig. 8.10). This Fragment’s layout (fragment_details.xml) consists of a ScrollView containing a vertical GridLayout with two columns of TextViews. A ScrollView is a ViewGroup that can contain other Views (like a layout) and that lets users scroll through content too large to display on the screen. We use a ScrollView here to ensure that the user can scroll through a contact’s details if a device does not have enough vertical space to show all the TextViews in Fig. 8.10. Follow the steps in Section 5.4.8 to create the fragment_details.xml file, but use a ScrollView as the Root Element. After creating ...

Get Android™ How to Program, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.