The root node of a layout resource file can use container controls (such as LinearLayout, Framelayout, and so on) or non-container controls (such as: EditText, TextView, and so on). For non-container controls, the <requestfocus/> label can only be placed in a non-container control label, indicating that the current control is set to focus. The following code:
<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Match_parent" android:layout_height= "match_parent" android:orientation= "vertical" > <button android:id= "@+id/buttonRi Ngtone "android:layout_width=" wrap_content "android:layout_height=" Wrap_content "android:text=" Set call tones "/> <button android:id=" @+id/buttonalarm "android:layout_width=" Wrap_content "android:layou t_height= "Wrap_content" android:text= "set alarm ringtone"/> <button android:id= "@+id/buttonnotification" Android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:text= "set notification ringtone"/> &L T EditText android:id= "@+id/text" android:layout_width= "match_parent" android:layout_height= "Wrap_conte NT > <!--the current control is in focus state-<requestfocus/> </EditText></LinearLayout>
after running, the EditText control is in the focus state and the cursor is moving and cannot be truncated. As shown in the following:
==================================================================================================
Ouyangpeng welcome reprint, sharing with people is the source of progress!
Reprint please keep the original address : Http://blog.csdn.net/ouyang_peng
==================================================================================================
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
My Android Advanced tour------>android <requestfocus/> Tag Usage