EditText Focus issue in "Android" ListView

Source: Internet
Author: User

First, Description:

A recent project needs to develop a table-like interface to display and configure parameters, Android does not have direct-like control support, I use the ListView layout EditText and TextView to implement, where TextView is used to display the parameter specifier, EditText is used to display parameter values, with a custom alertdialog pop-up display, as shown in.

Second, the question:

Developed APK software, the mobile phone control is OK, but on the TV can not be manipulated, the specific performance is:

Third, the settlement:

1 Fix the problem that the ListView cannot click By setting focus to stop on the ListView. Methods are as follows

2 on questions 2 and 3, itself and 1 are mutually exclusive, for example, I set the focus manually to EditText, at this time can not respond to click the ListView, More deadly, the logic is completely chaotic, for example, I press the DOWN ARROW, the cursor stays in the first column, and the focus has already followed the remote to move to the The next column, at this time, press OK, the modified or the cursor stays in the column of data, 3 is shown. Finally, after repeated attempts, the following solutions are resolved.

Workaround : Enter the following code in the ListView Setonitemselectedlistener onitemselected and Onnothingselected respectively

3 about question 4, can not call input method problem, the online introduction of 00 Total, most of them are useless, there is only one way is OK, the original link in this, the solution is as follows:

Iv. Description:

1 about android:descendantfocusability, there are three attribute values, described in the following table, detailed can refer to this post description.

Beforedescendants

ViewGroup takes precedence over its subclass control and gets to focus

Afterdescendants

ViewGroup gets focus only if its subclass control does not need to get focus

Blocksdescendants

ViewGroup overrides the subclass control and gets the focus directly

EditText Focus issue in "Android" ListView

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.