My Android advanced tour ------ & gt; Android & lt; requestFocus/& gt; tag usage, androidrequestfocus

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.