[mono-android] Listview - Select (Highlight) a row programmatically
Matteo Polito
mapo80 at gmail.com
Fri Oct 5 17:55:14 UTC 2012
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!!!!!
This is my code: var items = new string []{"Row 1", "Row 2", "Row 3", "Row
1", "Row 2", "Row 3", "Row 1", "Row 2", "Row 3", "Row 1", "Row 2", "Row 3",
"Row 1", "Row 2", "Row 3", "Row 1", "Row 2", "Row 3", "Row 1", "Row 2",
"Row 3", "Row 1", "Row 2", "Row 3"};
var ListAdapter = new ArrayAdapter<String> (this,
Android.Resource.Layout.SimpleListItem1, items);
ListView list = FindViewById(Resource.Id.listView1) as ListView;
list.Adapter = ListAdapter;
list.SetSelection(5);
list.Selected = true;
list.RequestFocus();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20121005/cb3d78c4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestListView.zip
Type: application/zip
Size: 10855 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20121005/cb3d78c4/attachment-0001.zip>
More information about the Monodroid
mailing list