Bug 58827 - Android ListView does not have SetSelector(Drawable drawable).
Summary: Android ListView does not have SetSelector(Drawable drawable).
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 7.3 (15.2)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2017-08-16 21:56 UTC by Adam
Modified: 2017-08-16 22:15 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Adam 2017-08-16 21:56:23 UTC
When trying to change the selector for a ListView programmatically to any color I want, I discovered that I am unable to make my own drawable in code.

When looking at the definition for the Android AbsListView in Xamarin, the method SetSelector(Drawable drawable) that is referenced https://developer.android.com/reference/android/widget/AbsListView.html#setSelector(android.graphics.drawable.Drawable) is not available.

I believe it should be.
Comment 1 Jon Douglas [MSFT] 2017-08-16 22:11:52 UTC
Hi Adam,

Thank you for the report. This is one of the cases where we provide the int method and not the Drawable method.

For example, you won't see this method in the following documentation:


The only method you'll find is the following:


There are many ways to workaround this by using the Int32 method, but it would be nicer to have a Drawable one exposed. Thus I am marking this issue as CONFIRMED.


Use the Resources.GetIdentifier method to get the respective identifier of the item, or use the Resource.drawable.resourcename

Now that this bug is CONFIRMED, we will get some Android Engineering eyes on it. Thanks again for the report!
Comment 2 Adam 2017-08-16 22:15:47 UTC
My main problem is that I cannot use a programmatically created drawable, so I have to have something premade in the XML. That is not always the case, especially for Forms projects, where I am looking to use this.

Note You need to log in before you can comment on or make changes to this bug.