1. hint
The hint attribute displays the hint text when the edittext is empty
<EditText
android:id="@+id/mytext" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:hint="Enter your name..."/>
android:id="@+id/mytext" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:hint="Enter your name..."/>
2. editable
The editable attribute takes two kind of values either true/false , by default editable attribute has true value , if you specify false then the edittext will not be editable
<EditText
android:id="@+id/mytext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:editable="false"/>
3. password
The password attribute allows you to display dots to the text entered in the edittext , this attribute takes two kind of values either true/false ,by default it contains false , if you specify true then the text in edittext will be set to dots.
<EditText
android:id="@+id/mytext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="password"
android:password="true"/>
4. requestFocus
This is not an attribute of edittext but instead it is a tag which must be placed inside the opening and closing tag of the edittext, the requestFocus tag gives focus to the specified edittext
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<requestFocus />
</EditText>
5. lines
The lines attribute makes the edittext to take the specified number of lines to enter the text
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="3" />
No comments:
Post a Comment