Begin by creating an Android project. Implement your Android application as normal. Once you have a project set up and the application running, decide under what screen you want to add Button controls to. Perhaps you’ve simply created a new Android project with its default Activity and layout (main.xml). This will work for this tutorial.
I'm doing basic UI design page for registration.
main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/SampleUI"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:textColor="#000fff"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:inputType="textPersonName"
android:hint="@string/firstName"
>
<requestFocus />
</EditText>
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:inputType="textPersonName"
android:hint="@string/lastName"/>
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textEmailAddress"
android:layout_marginTop="10dp"
android:hint="@string/email" />
<EditText
android:id="@+id/editText4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword"
android:layout_marginTop="10dp"
android:hint="@string/passwd" />
<EditText
android:id="@+id/editText5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone"
android:layout_marginTop="10dp"
android:hint="@string/Mobile"/>
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/submit"
android:textColor="#000fff"
android:layout_marginTop="20dp" />
</LinearLayout>
And open res->values->Strings.xml file. Copy below code.
Strings.xml:
<string name="app_name">Prakash_BasicUI</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="SampleUI">Registration</string>
<string name="firstName">FirstName</string>
<string name="lastName">LastName</string>
<string name="email">Email</string>
<string name="passwd">Password</string>
<string name="Mobile">Mobile Number</string>
<string name="submit">Submit</string>
</resources>
Screen will look like this......
No comments:
Post a Comment