Android Launcher activity text box does not get focus

Source: Internet
Author: User

In the development, often encounter this situation, open an activity, the first text box automatically get focus, and will pop up the soft keyboard input box, which greatly affect the user experience, now look at the solution.

Let's see why this is the case, the reason is very simple, the text box will be the focus of the default, after the focus will continue to pop up the input box, waiting for input, for this reason, we can have the following two scenarios:

1, do not let the text box to get focus;
2, get the focus does not pop up the input box;

To see the first method, we can preempt the focus of a text box, such as joining in its parent form:

1<LinearLayout2Xmlns:android="http://schemas.android.com/apk/res/android"3xmlns:tools="Http://schemas.android.com/tools"4Android:layout_width="match_parent"5android:layout_height="match_parent"6android:focusable="true"7Android:focusableintouchmode="true"8android:orientation="Vertical"9tools:context=". Mainactivity">Ten  One<EditText AAndroid:id="@+id/etmsg" -Android:layout_width="wrap_content" -android:layout_height="wrap_content"/> the</LinearLayout>

Look at the second method, add in the activity:

1 " Statehidden "

Reference

http://my.oschina.net/helu/blog/142020

Android Launcher activity text box does not get focus

Related Article

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.