开发者

Android, ListActivity and subviews

开发者 https://www.devze.com 2023-04-01 06:06 出处:网络
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 t

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消