[mono-android] Listview - Select (Highlight) a row programmatically

Enrico djtails at gmx.net
Sun Oct 7 00:22:25 UTC 2012


I have done it in my on way in Monodroid 4.0.

I have written my own listadapter extended with the BaseAdapter
  where i have a List with all records which are shown.

When i select one i changed the backround color or an image on the  
record and update the list.
This was my solution at that time because there where no listeners for  
this.

I have done it with the example from:
http://redth.info/2010/10/12/monodroid-custom-listadapter-for-your-listview/

If you are on the list you can also write a function for  
setSelectedRow(int i)
And switch in your arraylist[i] the BackgroundColor of the view and  
update the List.

For optimizing i have used some special things but this can give you  
the first impression how to do it.

Am 06.10.2012 um 08:20 schrieb Stephen Shaw:

> On Fri, Oct 5, 2012 at 11:55 AM, Matteo Polito <mapo80 at gmail.com>  
> wrote:
>> Hi guys, I'me becoming mad. I can't pre-select (hightlight) a row  
>> of a
>> listview. I've tried everything I've found on internet but nothing  
>> work.
>>
>> Attached there is a simple solution.
>>
>> Someone knows how to solve this problem. Thanks.
>>
>> Thanks!!!!!
>>
>
> It looks like its not really possible because of something called
> touch mode - http://android-developers.blogspot.com/2008/12/touch-mode.html
>
> A possible solution -
> http://stackoverflow.com/questions/5925892/android-how-do-i-highlight-a-row-in-listview
>
> Cheers,
> Stephen Shaw
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid




More information about the Monodroid mailing list