I want this effect
There textview and listview item imageButton, imageButton are hidden by default, and when I press the arrow keys when, item background to change, and the election to which the item, item must be displayed in the imagebutton, imagebutton alone can respond to events. The item did not focus becomes the default background inside imagebutton should be hidden.
This problem has plagued one week represents a
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
ListView xml file attributes plus "
android: descendantFocusability = "blocksDescendants" "
Find getview method listview, the judge gets the focus or not, there would visualize, did not as "gone"
Reply:
My item, there are three imagebutton, each button has a different event, that imagebutton to be able to get the focus of the three can click on each individual.
android: descendantFocusability = "blocksDescendants" add this item inside the property, then it can not get the focus of the imagebutton.
Reply:
Top

Reply:
Sink?

Reply:
Bangding! lz problem solved it? With demand!
Reply:
yes, Button is the focused control. . CheckBox same. .
Reply:
OnItemSelectedListener useless, have BUG, every time the switching time Item, Item background will flash, and when the focus disappeared Activity will go first to add a control that has the focus coming in, that whenever the switch once Item, Focus disappear -> Focus jump outside the ListView control -> Focus and then jump back to the next Item.
But the problem has been resolved, I TableLayout instead of using ListView implementation, there will not be above BUG
Reply:
Focus listview's a good solution, you have to first get your child focus, acquisition method android: descendantFocusability = "beforeDescendants", so that you can get every child to focus, listview achieve setOnItemSelectedListener then implement the following code in the callback in can,
public void onItemSelected (AdapterView parent, View view, int position, long id) {
mListView.clearFocus ();
ViewGroup viewGroup = (ViewGroup) view;
viewGroup.setDescendantFocusability (ViewGroup.FOCUS_BEFORE_DESCENDANTS);
viewGroup.requestFocus ();
}
Perhaps a better achieved.
Reply:
Hello My question is a bit like you, my listView no button, so the item can get the focus, but when I use the remote control up and down keys to move, how to change the item's background, change the focused item
No comments:
Post a Comment