We Can Set Input Type To The EditText.
In This Tutorial We Will Set Some Input Type Or Method's To The Edittext.
Create New Android Application Project And Name It As InputType.
Now Open Your activity_main.xml file And Add One EditText To It.
Add android:inputType="number" This Line To Your Edit text Xml.
Your actvity_main.xml Will Now Look Like Below.
activity_main.Xml
Or To Set Input Type To The EditText You May Directly Set Input Type Using Following Steps.
1. Go To Your activity_main.xml .
2. Select Graphical layout.
3. Right Click On Edittext.
Below Menu Will Appear On The Screen.
4. Now Click On Input Type. New Menu Option Menu Will appear . That all are Input Types.
You Can Select Your Input Types.
Input Types Menu as Below.
I Set Number as Input Type.
Now Set Your Own Input Type To Edittext.
All The Best :)
In This Tutorial We Will Set Some Input Type Or Method's To The Edittext.
Create New Android Application Project And Name It As InputType.
Now Open Your activity_main.xml file And Add One EditText To It.
Add android:inputType="number" This Line To Your Edit text Xml.
Your actvity_main.xml Will Now Look Like Below.
activity_main.Xml
<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" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginTop="20dp"
android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
</RelativeLayout>
Or To Set Input Type To The EditText You May Directly Set Input Type Using Following Steps.
1. Go To Your activity_main.xml .
2. Select Graphical layout.
3. Right Click On Edittext.
Below Menu Will Appear On The Screen.
4. Now Click On Input Type. New Menu Option Menu Will appear . That all are Input Types.
You Can Select Your Input Types.
Input Types Menu as Below.
I Set Number as Input Type.
Now Set Your Own Input Type To Edittext.
All The Best :)
No comments:
Post a Comment