Skip to content

Instantly share code, notes, and snippets.

@kalvian1060
Created May 13, 2017 07:50
Show Gist options
  • Save kalvian1060/aea316750203fef74a3612d87231eef9 to your computer and use it in GitHub Desktop.
Save kalvian1060/aea316750203fef74a3612d87231eef9 to your computer and use it in GitHub Desktop.
Pengunaan Linear Layout horizontal dan vertical
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/colorPrimary"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center_horizontal"
android:text="FORM PENDAFTARAN SISWA"
android:textColor="@android:color/white"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nama Depan" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nama Belakang" />
<EditText
android:layout_width="match_parent"
android:layout_height="100dp"
android:gravity="top|left"
android:hint="Alamat" />
<EditText
android:layout_width="match_parent"
android:layout_height="100dp"
android:gravity="top|left"
android:hint="Tempat Lahir" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:hint="TGL"
android:inputType="number" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:hint="BULAN"
android:inputType="number" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:hint="TAHUN"
android:inputType="number" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2px" />
<Button
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/colorPrimary"
android:text="DAFTAR"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment