Sep 29, 2013

Request focus on a specified EditText view in startup, in XML

Last example show Java code to "Request focus on a specified EditText view in startup, by calling requestFocus()". Alternative, it can be achieve by specifying <requestFocus /> in XML.

It's a example to request focus on edittext3, modify layout from last example.

    <EditText
        android:id="@+id/edittext3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <requestFocus />
    </EditText>


focus on edittext3
Focus on edittext3, defined in XML.

No comments:

Post a Comment

Infolinks In Text Ads