Relative Layout, Frame Layout, Table Layout (Pertemuan 4)

Nama : Rina Windasari

NIM :  217200016


1. Relative Layout

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:paddingLeft="16dp"

    android:paddingRight="16dp">

    <EditText

        android:id="@+id/nama"

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:hint="Nama"/>

    <LinearLayout

        android:orientation="vertical"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:layout_alignParentStart="true"

        android:layout_below="@+id/nama">


        <Button

            android:id="@+id/name"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="Tambah" />


        <Button

            android:id="@+id/button"

            android:layout_width="99dp"

            android:layout_height="wrap_content"

            android:text="Ubah" />


        <Button

            android:id="@+id/button2"

            android:layout_width="101dp"

            android:layout_height="wrap_content"

            android:text="Kirim" />

    </LinearLayout>


Hasilnya : 



2. Frame Layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp">
    <EditText
        android:id="@+id/nama"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Nama"/>
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/nama">

        <Button
            android:id="@+id/name"
            android:layout_width="wrap_content"
            and…
[16.49, 3/3/2023] Rina Windasari: <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="100"
    android:orientation="vertical"
    android:padding="10dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:src="@drawable/smurf" />

    <TextView
        android:layout_width="165dp"
        android:layout_height="97dp"
        android:gravity="center"
        android:layout_marginStart="110dp"
        android:layout_marginEnd="100dp"
        android:text="SMURF" />

</FrameLayout>



Hasilnya :





3. Table Layout

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="100"
    android:orientation="vertical"
    android:padding="10dp">


    <TableRow>
    <TextView
        android:text="Nama"
        android:layout_column="1"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"/>
    <EditText
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:layout_column="2"
        android:hint="masukan nama"/>
    </TableRow>
    <TableRow>
        <TextView
            android:text="Nama"
            android:layout_column="1"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"/>
        <EditText
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:layout_column="2"
            android:hint="masukkan nama"/>
    </TableRow>
</TableLayout>



Hasilnya : 





Komentar