Linear Layout di Android Studio




hello temen2
yuk kita belajar membuat linear layout di projek pertama kita di android studio
yaitu membuat linear layout...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="#f00"
            android:gravity="center"
            android:padding="45dp"
            android:textColor="#fff"
            android:text="PUTIH"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="#0f0"
            android:padding="45dp"
            android:gravity="center"
            android:text="HIJAU"
            android:textColor="#fff"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:background="#00f"
                android:textColor="#fff"
                android:text="BIRU"
                android:layout_weight="1"/>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:background="#FCF802"
                android:textColor="#fff"
                android:text="KUNING"
                android:layout_weight="1"/>


        </LinearLayout>
    </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="BARIS PERTAMA"
                    android:textSize="15pt"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="BARIS KEDUA"
                    android:textSize="15pt"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="BARIS KETIGA"
                    android:textSize="15pt"/>



            </LinearLayout>

</LinearLayout>

bila selesai,klik tombol untuk me"run" kannya.. dan lihat hasilnya..





selamat di coba...

Komentar

Postingan populer dari blog ini

Relay lampu menggunakan NodeMCU

Kode program (sketch) DHT11 di Arduino Uno

Kode program ( sketch ) sensor infrared di Arduino Uno with buzzer