Android: ListView Item selected color is by default Orange and no property available to change this color
See original GitHub issueDescription
In MAUI ListView control the Item selected color on Android by default is Orange and there doesn’t seem to be any property or something mentioned in MAUI documentation “https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/listview?view=net-maui-7.0” using which we can change this color. So, please explain why it is Orange by default on Android and how to change this for Android to Grey/ Any other color similar to how it behaves on iOS and shows item selected color as grey?
Below is the Screenshot for reference:
Steps to Reproduce
Download solution here
https://github.com/muffadal53/MauiListViewItemSelectedColorOrangeAndroid.git
Run solution
On MainPage, select any item from the ListView by tapping/pressing on that item on mobile.
The default color shown in Android for that selected item is “Orange” --> This is Not OK
Link to public reproduction project repository
https://github.com/muffadal53/MauiListViewItemSelectedColorOrangeAndroid.git
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
No.
Relevant log output
N/A.
Issue Analytics
- State:
- Created 6 months ago
- Reactions:3
- Comments:5 (2 by maintainers)
@cat0363 Thanks for your inputs on workaround but in Xamarin Forms also there was a discussion on this and need to have some mechanism in the framework to change this as mentioned in this link “https://github.com/xamarin/Xamarin.Forms/issues/4447” and there was a mechanism as mentioned below to achieve this as mentioned below (though I haven’t used myself in Xamarin Forms):
<item name="android:colorActivatedHighlight">@android:color/transparent</item>
And if you see the last comment in that link it says to open a new discussion in .Net MAUI as needed and that what exactly above I have mentioned. Hope this clarifies the point.
Thanks.
Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on Android platform with sample project. https://github.com/muffadal53/MauiListViewItemSelectedColorOrangeAndroid.git