In the last post we looked about the Compound drawables that makes the easy designing of your app.
The compound drawables can be used to place the image next to textbox.
So In this post we will go through an example of using it by creating a sample login screen.
In the last post we looked about the Compound drawables that makes the easy designing of your app.
The compound drawables can be used to place the image next to textbox.
So In this post we will go through an example of using it by creating a sample login screen.
So let’s start by creating a new project.
1. Create a new project in Eclipse from File --> New --> Android --> Application Project. While creating the project select the app theme which has Action Bar as shown in the below image.
2.Open the activity_main.xml for creating the layout of the app.
Type the code in the activity_main.xml
The compound drawables can be used to place the image next to textbox.
So In this post we will go through an example of using it by creating a sample login screen.
In the last post we looked about the Compound drawables that makes the easy designing of your app.
The compound drawables can be used to place the image next to textbox.
So In this post we will go through an example of using it by creating a sample login screen.
So let’s start by creating a new project.
1. Create a new project in Eclipse from File --> New --> Android --> Application Project. While creating the project select the app theme which has Action Bar as shown in the below image.
2.Open the activity_main.xml for creating the layout of the app.
Type the code in the activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="16dp"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:hint="@string/user_name"
android:drawableLeft="@drawable/ic_action_person"
android:drawablePadding="8dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:hint="@string/password"
android:drawableLeft="@drawable/ic_action_accounts"
android:drawablePadding="8dp"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_in"
android:drawableRight="@drawable/ic_action_accept"
/>
</LinearLayout>
3.Run the app
Please subscribe to our site.Share it on facebook and twitter.
4 comments
Too good bro! your blog is too helpful
This is nice written blog ! too gud
Great Explaination learned a new thing
Please Provide XML File of Android UI
EmoticonEmoticon