I have a ListActivity
which displays a ListView
. I'm starting the activity from my main activity, and I'd like for the list view to appear as a subview in the view of my main activity. How do I do this?
(It's enough to answer the more general question - how do you bind an activity to a subview in the content view of 开发者_JAVA百科another activity?)
Set the id of your ListView to andriud:id="@android:id/list". See the Javadoc for ListActivity:
[Y]ou can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id "@android:id/list" (or list if it's in code)
精彩评论