I am using a listview widget in my android app, I would like to add two buttons below it in a fixed position (You can scroll the list but the two buttons must always appear below it). Something like this:
------------
| |
| List |
| |
| |
------------
| But1 But2 |
------------
In the android xml file graphical view everything looks OK. However, when I try to run the app the list-view appears but the buttons do not. Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="411dp" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:background="@drawable/darkbg"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/butEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_style"
android:text="@string/delete_button"
android:textColor="#FFFFFF" />
<Button
android:id="@+id/butOpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_style"
android:text="@string/open_button"
android:textColor="#FFFFFF" />
</LinearLayout>
</LinearLayout>
How can I get it to work? Any help would be highly appreciated.
Code (after update - nothing changed):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomLinearLayout" />
<LinearLayout
android:id="@+id/bottomLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dp"
android:background="@drawable/darkbg"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<Button
android:id="@+id/butEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_style"
android:text="@string/delete_button"
android:textColor="#FFFFFF" />
<Button
android:id="@+id/butOpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_style"
android:text="@string/open_button"
android:textColor="#FFFFFF" />
</LinearLayout>
</RelativeLayout>
Aucun commentaire:
Enregistrer un commentaire