Mudassir
Mudassir

Reputation: 13174

ListView with other elements

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. :-)

Upvotes: 0

Views: 512

Answers (2)

Chromium
Chromium

Reputation: 1073

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

Upvotes: 1

David Brown
David Brown

Reputation: 3061

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 ;-)

Upvotes: 1

Related Questions