- Image Button
package app.seamolec.co;
import android.app.Activity;
import android.os.Bundle;
public class CobaActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Tampilan Image Button :
- Toggle Button
Program untuk Toggle Button :
<ToggleButton android:textOn="Run" android:textOff="Stop" android:text="ToggleButton" android:layout_weight="0.03" android:id="@+id/toggleButton1" android:layout_height="wrap_content" android:layout_width="67dp"></ToggleButton>
Tampilan Toggle Button :
- CheckBox
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Makanan kesukaan :">
</TextView>
<CheckBox android:text="Nasi Goreng" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<CheckBox android:text="Nasi Pecel" android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<CheckBox android:text="Nasi Uduk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<CheckBox android:text="Nasi Kuning" android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
- Analog dan Digital Clock
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<AnalogClock android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<DigitalClock android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Tampilan :
- Radio Button
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<RadioButton android:id="@+id/radio0" android:text=" Nasi Goreng" android:layout_height="wrap_content" android:layout_width="wrap_content" android:checked="true"></RadioButton>
<RadioButton android:id="@+id/radio1" android:text=" Nasi Uduk" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
<RadioButton android:id="@+id/radio2" android:text=" Nasi Pecel" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton>
</RadioGroup>
</LinearLayout>
Tampilan :
- RatingBar
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numStars="5" android:stepSize="0.5"></RatingBar>
</LinearLayout>
Tampilan RatingBar :
Demikian beberapa contoh program pada Android. Semoga bermanfaat.
Posted by Melysa Sparingga