3. Pada Package Explorer , pilih
Relative > res > layout > main.xml . ( Gambar 4.2 )
4. Gantilah dengan kode dibawah ini .
<?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:gravity="top">
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:"/>
<EditText
android:id="@+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/label"/>
<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/entry"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip"
android:text="OK" />
<Button
android:layout_alignTop="@id/ok"
android:text="Cancel"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toLeftOf="@+id/ok"
android:layout_below="@+id/entry"/>
</RelativeLayout>
5. Pastikan pada
RelativeLayout.java seperti di bawah ini . ( Gambar 4.3 )
package relativeLayout.source;
import android.app.Activity;
import android.os.Bundle;
public class RelativeLayout extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

\
6. Lakukan Run dengan shortcut CTRL + F11 atau klik kanan package > run as > android Project.
7. Lihat hasilnya seperti Gambar 4.1
Gimana Sobat , mudah kan ?
Mungkin ini aja Tutorial Pemrograman android kali ini sobat . Sampai Jumpa di Tutorial selanjut nya :D
Sumber : OmAyib.com