EditText is embedded in ListView, which causes Android keyboard crash. edittext android

Source: Internet
Author: User

EditText is embedded in ListView, which causes Android keyboard crash. edittext android

Today, I encountered a strange problem. When I clicked EditText on my hammer and Samsung mobile phone, the keyboard flashed and fell back. I did not find this problem on other mobile phones, and I did not find it after searching for a long time, after that, I finally found the answer on StackOverFlow and shared the answer here.

Http://stackoverflow.com/questions/20406472/edittext-in-listview-loses-focus-when-pressed-on-android-4-x

The reason is that when EditText is in ListView, when EditText gets the focus, the ActionBar will take the focus away, causing the keyboard to flash and exit.

The solution is as follows:

First, add

Android: descendantFocusability = "beforeDescendants"

Then add

Android: windowSoftInputMode = "adjustPan"

Run it again.


If you feel helpful to yourself, I hope you can help me with it. Thank you :)
Blog: http://blog.csdn.net/zhaoxy2850
Address: http://blog.csdn.net/zhaoxy_thu/article/details/45200285
Please indicate the source for reprinting. Thank you!

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.