4.3.3. Customizing a ListActivity’s Layout
A ListActivity
’s default GUI contains only a ListView
that fills the screen’s client area between Android’s top and bottom system bars (which were explained in Fig. 2.1). If a ListActivity
’s GUI requires only the default ListView
, then you do not need to define a separate layout for your ListActivity
subclass.
The Twitter Searches app’s MainActivity
displays several GUI components. For this reason you’ll define a custom layout for MainActivity
. When customizing a ListActivity
subclass’s GUI, the layout must contain a ListView
with its Id attribute set to "@android:id/list"
—the name that class ListActivity
uses to reference its ListView
.
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.