Banner

Cara Menggunakan Layout Di Eclipse

1. Relative Format

Program

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

android:layout_width="match_parent"

android:layout_height="match_parent" >

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/hello_world"

android:layout_alignParentLeft="true"

android:id="@+id/z"/>

<Button

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/click1"

android:layout_toRightOf="@+id/z"

android:id="@+id/z2"

/>

<TextView

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/hello_world"

android:layout_toRightOf="@+id/z2"

android:id="@+id/z3"/>

<Button

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/click1"

android:layout_alignParentBottom="true"

/>

</RelativeLayout>

String

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

<resources>

<string name="app_name">Relative2</string>

<string name="action_settings">Settings</string>

<string name="hello_world">Zamaluddin</string>

<string name="click1">CLICK</string>

<string name="click">Click</string>

</resources>

2. Straight Design

Program

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

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

>

<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/hello_world"/>

<Button

android:id="@+id/textView2"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="@string/click1"/>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal" >

<TextView

android:id="@+id/textView3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/hello_world"/>

<Button

android:id="@+id/textView4"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/click"/>

</LinearLayout>

<TextView

android:id="@+id/textView5"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/hello_world"/>

<Button

android:id="@+id/textView6"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/click1"/>

</LinearLayout>

String

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

<resources>

<string name="app_name">Assalamualaikum</string>

<string name="action_settings">Settings</string>

<string name="hello_world">Assalamualaikum</string>

<string name="click1">CLICK</string>

<string name="click">Click</string>

</resources>

Download Aplikasi Instructional exercise Android lainnya di bawah ini :
   

Subscribe to receive free email updates:

0 Response to "Cara Menggunakan Layout Di Eclipse"

Post a Comment