Header Dan Footer Layout Android Kode
![]() |
| cerita anak: "semut dan belalang" |
Bagaimana cara membuat header layout dan footer layout di android kode, berikut ini adalah kodenya.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:background="#D32B67" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:text="Ini adalah Header" android:textColor="#000000" android:textSize="20sp"/> </RelativeLayout> <RelativeLayout android:id="@+id/footer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="#94D6DE" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:text="Ini adalah Footer" android:textColor="#000000" android:textSize="20sp"/> </RelativeLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@id/footer" android:layout_below="@id/header" android:gravity="center" android:background="#BDC199"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Isi kontent" android:textColor="#FFFFFF" android:textSize="20sp"/> </RelativeLayout> </RelativeLayout>

