In this Tutorial we will design effective UI Design in android. Design is very simple show below example.
res/layout/drawable/edit_text_gradient.xm
.................................................................................................................................................................
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="15dp">
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"/>
<stroke android:width="2dip" android:color="#5079f4" />
</shape>
res/layout/drawable/button_action.xml
..................................................................................................................................................................
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="#76b8f2" />
<stroke
android:width="1dp"
android:color="#2f6699" />
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"/>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="#449def"
android:endColor="#2f6699"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#ffffff" />
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp"/>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
res/layout/activity.xml
...................................................................................................................................................
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/loginpage_icon"
android:gravity="center">
<EditText
android:id="@+id/editText_user"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:layout_marginTop="54dp"
android:ems="10"
android:maxLines="1"
android:textStyle="italic"
android:hint="@string/hintuesre"
android:background="@drawable/edit_text_gradient"
android:paddingLeft="10dp">
<requestFocus />
</EditText>
<EditText
android:id="@+id/editText_password"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:inputType="textPassword"
android:ems="10"
android:maxLines="1"
android:textStyle="italic"
android:hint="@string/hintpas"
android:background="@drawable/edit_text_gradient"
android:paddingLeft="10dp">
</EditText>
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/showpass" />
<Button
android:id="@+id/button_login"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/login"
android:textColor="#ffffff"
android:background="@drawable/button_action" />
</LinearLayout>
0 comments