Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-21 Thread Miha Valencic
On Tue, May 21, 2013 at 12:11 AM, Miha Valencic miha.valen...@gmail.com wrote: In this case, which is the correct state? I now see that state_activated works as expected, though as Kostya mentions, it is API Level 11 and beyond. Is there an alternatvive for API level 10? So... I've implemented

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-21 Thread Kostya Vasilyev
Miha, On Tuesday, May 21, 2013 12:57:38 PM UTC+4, Miha wrote: Kostya, how do you handle checked states then? I see two possible solutions: 1) in OnItemClickListener, call adapter.setChecked(position), which sets the checked item position and then calls notifyDataSetChanged() 2) in

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-21 Thread Miha Valencic
Hi Kostya! On Tue, May 21, 2013 at 8:37 PM, Kostya Vasilyev kmans...@gmail.com wrote: I call setChecked directly, because my checkbox tracking is in the same layout (although it's not a checkbox) To track selected items (for getView to do the right thing during scrolling, and to know what

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Justin Anderson
On Thu, May 16, 2013 at 3:14 AM, Miha miha.valen...@gmail.com wrote: One possible solution I see is modifying the backing adapter implementation and providing a different view based on the state of the item, but that seems like wrong approach -- I would have to update the adapter with

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Kostya Vasilyev
Maybe it's just me, but... On Monday, May 20, 2013 6:39:14 PM UTC+4, MagouyaWare wrote: On Thu, May 16, 2013 at 3:14 AM, Miha miha.v...@gmail.com javascript:wrote: One possible solution I see is modifying the backing adapter implementation and providing a different view based on the

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Justin Anderson
That is actually more along the lines of what I was talking about, now that I think about it... Changing the background color or drawable for a selected item rather than inflating a completely different view. I didn't use a selector to do that, but I like that approach better. I was simply

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
Hi Kostja et al! On Mon, May 20, 2013 at 5:01 PM, Kostya Vasilyev kmans...@gmail.com wrote: Maybe it's just me, but... No, it's not just you. I also expect that framework should handle this. And it does, as long as list item layout does not have a background set. Let me prepare a demo, and

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Romain Guy
The list selector is drawn by default under list items. You can either change it to draw on top (but you'll have to use custom drawables so the items are visible underneath) or use a background on your list items with a selected state. On Mon, May 20, 2013 at 11:19 AM, Miha Valencic

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
Hi everybody! On Mon, May 20, 2013 at 8:46 PM, Romain Guy romain...@android.com wrote: The list selector is drawn by default under list items. You can either change it to draw on top (but you'll have to use custom drawables so the items are visible underneath) or use a background on your

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
On Mon, May 20, 2013 at 9:23 PM, Miha Valencic miha.valen...@gmail.com wrote: Am I misunderstanding this statement: ...or use a background on your list items with a selected state.? Also, one more thing: does it even makes sense to use listselector (setSelector) if the background is a state

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Romain Guy
The selected state is used when the item is focused using a keyboard. It has nothing to do with the choice mode. On May 20, 2013 12:32 PM, Miha Valencic miha.valen...@gmail.com wrote: On Mon, May 20, 2013 at 9:23 PM, Miha Valencic miha.valen...@gmail.com wrote: Am I misunderstanding this

Re: [android-developers] ListView with selected state does not work when list item view has a background

2013-05-20 Thread Miha Valencic
On Mon, May 20, 2013 at 10:15 PM, Romain Guy romain...@android.com wrote: The selected state is used when the item is focused using a keyboard. It has nothing to do with the choice mode. In this case, which is the correct state? I now see that state_activated works as expected, though as Kostya

[android-developers] ListView with selected state does not work when list item view has a background

2013-05-16 Thread Miha
Hi! I'm trying to understand the mechanics behind highlighting the selected list item. I have a list fragment, which might display with a secondary details fragment if the screen width allows it. In that case, I want to highlight the selected list item. In order to do so, the listview has