Login screen with Compound drawables


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

<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.


Alll the world is a laboratory to the inquiring mind! Join Us

Comments

Alexfollows said…
Too good bro! your blog is too helpful
Alexfollows said…
This is nice written blog ! too gud
Alexfollows said…
Great Explaination learned a new thing
chintan Patel said…
Please Provide XML File of Android UI

Popular posts from this blog

Android Navigation Drawer sliding menu with fragments

8 Effective plots with Matplotlib and Pandas Dataframe

Step by Step Guide to Setup Android 5.0 Lollipop Sdk in Eclipse