Page 26 - 24JAM_Pintar_Pemrograman_Android__1-libre
P. 26

  24 JAM!! Pintar Pemrograman Android
            3.  Pilih  LinearLayoutSederhana  /res  /layout/main.xml,  lihat
                Gambar 3.3

















                                       Gambar 3.3
            4.  Ketikkan  kode  berikut  ini.  Meskipun  panjang,  script  ini
                memiliki  kemiripan.  Sementara  cukup  tulis  satu  pola  saja,
                lakukan copy-paste-edit.
               1:  <?xml version="1.0" encoding="utf-8"?>
               2:  <LinearLayout
               3:  xmlns:android="http://schemas.android.com/apk/res/android"
               4:      android:orientation="vertical"
               5:      android:layout_width="fill_parent"
               6:      android:layout_height="fill_parent">
               7:
               8:    <LinearLayout
               9:        android:orientation="horizontal"
               10:        android:layout_width="fill_parent"
               11:        android:layout_height="fill_parent"
               12:        android:id="@+id/LinearLayout1"
               13:        android:layout_weight="1">
               14:        <TextView
               15:            android:text="Merah"
               16:            android:gravity="center_horizontal"
               17:            android:background="#aa0000"
               18:            android:layout_height="fill_parent"
               19:            android:layout_weight="1"
               20:            android:layout_width="wrap_content"/>
               21:        <TextView
               22:            android:text="Hijau"
               23:            android:gravity="center_horizontal"
               24:            android:background="#00aa00"
               25:            android:layout_width="wrap_content"
               26:            android:layout_height="fill_parent"
               27:            android:layout_weight="1"/>
               28:        <TextView
               29:            android:text="Biru"
               30:            android:gravity="center_horizontal"
               31:            android:background="#0000aa"
               32:            android:layout_width="wrap_content"
               33:            android:layout_height="fill_parent"
               34:            android:layout_weight="1"/>
               35:        <TextView
               36:            android:text="Kuning"
                              Dapatkan materi terbaru di                   26
                                       www.omayib.com
   21   22   23   24   25   26   27   28   29   30   31