I try place the button below a List, but the button does not appear.
I use RelativeLayout.
activity_main.xml
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Lista"
>
<ListView
android:id="@+id/listFotMultas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RelativeLayout>
<Button
android:layout_below="@+id/Lista"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Total Fotomulta"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:background="@drawable/estilo_redondoboton"
/>
</RelativeLayout>
I solved my problem, delete the property layout_below in my button
android:layout_below="@+id/Lista"
Add the property in my button layout_alignParentBottom
android:layout_alignParentBottom="true"
And add the property layout_marginBottom in my relative @+id/Lista
android:layout_marginBottom="50dp"
<RelativeLayout
android:layout_below="@+id/ListaEncabezado"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:id="@+id/Lista"
>
<ListView
android:id="@+id/listFotMultas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</ListView>
</RelativeLayout>
<Button
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Total Fotomulta"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:background="@drawable/estilo_redondoboton"
/>
</RelativeLayout>
Hello Using below layout u can also have button visible :- [NOTE:- this suggestion is given for the reason if you want to use linearlayout instead of relative layout you can try this way ]
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView
android:id="@+id/listFotMultas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="Total Fotomulta" />
THANKS!~!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.