开发者

problem with ExpandableListView in Android

开发者 https://www.devze.com 2023-01-25 12:40 出处:网络
I have one activity (Home.class), and that activity contains 3 views: first_view.xml, second_view.xml,third_view.xml

I have one activity (Home.class), and that activity contains 3 views:

first_view.xml, second_view.xml,third_view.xml

first_view.xml contains 2 buttons (btnSecond and btnThird). If I click btnSecond, second_view.xml will appear. If I click btnThird, third_view.xml will app开发者_如何学Pythonear.

In the third view there is a ExpandableListView. So I extend ExpandableListActivity in the Home.class. But now there is a problem.

When I am running, an exception occurs:

java.lang.RuntimeException: Your content must have a ExpandableListView whose id attribute is 'android.R.id.list'

When I use ExpandableListView in all xml files, the problem is solved. But I want to display this list only in third_view.xml. How can I solve this problem?


Make sure you name the list view "@android:id/list". Go here for more info.

0

精彩评论

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