♠ Posted by ANDROID THIRST in ANDROID TOTURIALS
Buttons are the type of view that is created to be pressed . When the user clicks on the button in an android application the application is respond something. In this tutorial, we are going to create a different type of button .
There are three types of button in android
1.Button with Text
2. Button with Image
3.Button with Text and Image
1. Button with Text:-
Step 1. Create a project buttonWidget.
Step 2. Add following code in activity_main.xml
<
Button
android:id="@+id/button1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="ClickMe"
android:textsize="30dp"
android: background="#0000aa" />
2. Button with Image: -
Just under the Text button use ImageButton view to create an ImageButton . Put the following
code just under the Text button.
<
ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
...