Hi!

Anybody has a similar experience or ...? How do you otherwise select a 
listview item in a "dual pane" layout? 

Regards,
 Miha.

On Thursday, May 16, 2013 11:14:29 AM UTC+2, Miha wrote:
>
> 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 defined choice mode of single, and also a defined selector:
>
> listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
> listView.setSelector(R.drawable.listitem_selector);
>
> The list uses a custom view for layout, and when the view does not set the 
> "android:background", the listitem_selector works -- it shows on the 
> screen. When the row layout has a background set to a drawable (in my case, 
> it is selector, consisting of colors), the listitem_selector does not work. 
> I tried the methods explained in the stackoverflow 
> post<http://stackoverflow.com/questions/2562051/listview-item-background-via-custom-selector>,
>  
> but the approach does not work, at least not in my case.
>
> I'm obviously missing a part of the puzzle and I would appreciate any 
> insight into this matter.
>
> 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 information on the selected item and call 
> notifyDataSetChanged, which would (I suppose) result in an unnecessary 
> re-drawing of the whole list.
>
> Regards,
>  Miha.
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to