Button pada android adalah tombol yg dapat di click dll yg bisa diberikan aksi kpd tombop tsb, seperti pindah activity baru dan sbagainya
1. Button dengan text
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<!-- button dengan text -->
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/mainRelativeLayout1">
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Button"/>
</RelativeLayout>
<!-- button dengan gambar -->
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="@+id/mainRelativeLayout1">
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Anu"
android:drawableLeft="@drawable/ic_launcher"/>
</RelativeLayout>
</RelativeLayout>
Full Source Code
Tidak ada komentar:
Posting Komentar