My Android Advanced tour------>android <requestfocus/> Tag Usage

Source: Internet
Author: User

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

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.