开发者

ListView with other elements

开发者 https://www.devze.com 2023-01-22 01:07 出处:网络
I want to show a ListView with two Buttons belows (outside of list) it. But as my Activity extends ListActivity, I am facing problems on setContentView. Can anybody please help me?

I want to show a ListView with two Buttons belows (outside of list) it. But as my Activity extends ListActivity, I am facing problems on setContentView. Can anybody please help me?

Updates: Solution

I got the solution. No matter which and how many elements we use on a ListActivity, the id (android:id) of ListView in XML file must be @android:id/list. :开发者_Python百科-)


Set the id (android:id) of ListView in XML file to @android:id/list.


Can you post your layout XML?

Basically if you're using Linear Layouts the hierarchy will be as such

LinearLayout (orientation:vertical)
   |---ListView (layout-weight:1)
   |---LinearLayout (used for buttons)
            |-- Button 1
            |-- Button 2

If you show me you XML I can show you what you need to do..Unless the above snippet helps you fix it of course ;-)

0

精彩评论

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