Translate To Your Own Langauge
TextView & EditText
In this tutorial, I will explain the concept of EditText and TextView controls provided in Android. If you are new to android then see
Getting Started with Android.
Make following .xml file
- EditText is used to get value from user (Input control).
- TextView is used to display value on the screen (Output control).
Make following .xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="39dp" android:text="@string/username" android:textAppearance="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="32dp" android:text="@string/password" android:textAppearance="?android:attr/textAppearanceLarge" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/textView1" android:layout_marginLeft="38dp" android:layout_toRightOf="@+id/textView1" android:ems="10" > <requestFocus /> </EditText> <EditText android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView2" android:layout_alignBottom="@+id/textView2" android:layout_alignLeft="@+id/editText1" android:ems="10" android:inputType="textPassword" /> </RelativeLayout> |
Now your Interface is ready. You can run the app on your device or on virtual device.
If you don't know how to make virtual device then click here.
Subscribe to:
Post Comments (Atom)
You may be interested in:
- Registration Form in Android with Validation
- Login with Validation (Android Example)
- Implementing Tab Example in android using TabActivity
- Splash screen in Android using Thread
- Showing Map
- button in android example
- Spinner Android Example
- Change the Profile Mode Programmatically (Android Example)
- Login Example (Android)
- Generating Google APIs
0 Responses to “TextView & EditText”
Post a Comment
Comment your feedback for the post. You can also ask your queries regarding android.