O'Reilly logo

Android User Interface Development by Jason Morris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - improving the restaurant list

The list of restaurants we put together earlier is nice, but it's a menu. In order to further emphasize the menu, the text should stand out more. In order to style a ListView with a standard ListAdapter implementation, you will need to specify the ListAdapter object in your Java code.

  1. Create a new file in the res/layout directory named menu_item.xml.
  2. Create the root XML element as a TextView:
    <?xml version="1.0" encoding="UTF-8"?> <TextView />
    
  3. Import the Android resource XML namespace:
    xmlns:android="http://schemas.android.com/apk/res/android"
    
  4. Center the text in the TextView widget by setting its gravity:
    android:gravity="center|center_vertical"
    
  5. We assign the textSize of the TextView to our standard ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required