My Android advanced tour ------> Android <requestFocus/> label usage, androidrequestfocus
You can use container controls (such as LinearLayout and FrameLayout) or non-container controls (such as EditText and TextView) to layout the root node of the resource file ). For non-container controls, the <requestFocus/> label can only be placed in the 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/buttonRingtone" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "set ringtone"/> <Button android: id = "@ + id/buttonAlarm" android: layout_width = "wrap_content" android: l Ayout_height = "wrap_content" android: text = "Set alert tone"/> <Button android: id = "@ + id/buttonNotification" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "set notification ringtones"/> <EditText android: id = "@ + id/text" android: layout_width = "match_parent" android: layout_height = "wrap_content"> <! -- The current control is in focus state --> <requestFocus/> </EditText> </LinearLayout>
After running, the EditText control is in the focus state, and the cursor keeps moving and cannot be captured. As shown in:
========================================================== ========================================================== ============================
Author: Ouyang Peng: Welcome to repost. sharing with others is the source of progress!
Reprinted Please retain the original address: http://blog.csdn.net/ouyang_peng
========================================================== ========================================================== ============================
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.