Android Cancel EditText automatically get focus default behavior _android

Source: Internet
Author: User
In a project, as soon as you enter a page, EditText automatically gets the focus by default.

So how do you cancel this default behavior?
Looking for a long time on the internet, a bit of listening to soft keyboard events, a bit called Clearfouse () method, but the test has not! The corresponding property could not be found in the XML to turn off this default behavior
Solution: Find one in the parent control of the EditText, set to
Copy Code code as follows:

Android:focusable= "true"
Android:focusableintouchmode= "true"

In this way, the default behavior of the EditText is truncated!
Copy Code code as follows:

<linearlayout
style= "@style/fillwrapwidgetstyle"
Android:o rientation= "vertical"
android:background= "@color/black"
android:gravity= "Center_horizontal"
Android: Focusable= "true"
Android:focusableintouchmode= "true"
>
<imageview
android:id= "@+id/logo" br>style= "@style/wrapcontentwidgetstyle"
android:background= "@drawable/dream_dictionary_logo"
/>
& Lt Relativelayout
style= "@style/fillwrapwidgetstyle"
android:background= "@drawable/searchbar_bg"
Android : gravity= "center_vertical"
>
<edittext
android:id= "@+id/searchedittext"
style= "@style/wrapco Ntentwidgetstyle "
android:background=" @null
android:hint= "Search"
android:layout_marginleft= "40DP" android:singleline= "true"
/>
</RelativeLayout>
</LinearLayout>

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.