question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android: ListView Item selected color is by default Orange and no property available to change this color

See original GitHub issue

Description

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: image

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:open
  • Created 6 months ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
muffadal53commented, Mar 10, 2023

@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.

0reactions
homeyfcommented, Jun 14, 2023

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 image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set the selecteditem background color in List View ...
There is a known issue reported at GitHub- Android: ListView Item selected color is by default Orange and no property available to change...
Read more >
How do I change the color of a selected item on a ListView?
I'm creating a ListView that has some simple items inside a ViewCell. When I select one of the items it becomes orange. When...
Read more >
How to get rid of the orange BackgroundColor in ListView?
Hey Guys, i wanted to created a Listview and when I select an item from the listview, the background becomes orange.
Read more >
Changing ListView Selection color with a Custom Renderer
First, of course, I had to make sure that I had a custom renderer for the TextCell that I was using, so if...
Read more >
How to Change the Background Color of Button in Android ...
The color state list is defined in XML and saved under the res/color folder. The root element of the color state list is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found