Xamarin.forms: Listview Onclicked Orange background in Android

Created on 16 Nov 2018  Â·  9Comments  Â·  Source: xamarin/Xamarin.Forms

Description

Steps to Reproduce

  1. Create xamarin.forms project with a listview in it. If you click in the listview to a detailpage the background is a terrible orange color. To work around is not easy. Please make it a general color instead or orange.


    1. 3.

Expected Behavior

Actual Behavior

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:

    • iOS:

    • Android:

    • UWP:

  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

Reproduction Link

F100 listview high impact proposal-open enhancement âž•

Most helpful comment

I am trying to paste the code, but it comes out strange. But you go to Android project - resources - values - styles.xml. And then item name="android:colorActivatedHighlight">@android:color/transparent. You do this exactly like the line above between tags.

All 9 comments

Even I face this issue. Whenever clicking on list item it is showing Orange color. When you want to change that orange color you need to write custom render or some tricky logic in shared project. I tried that once doing from shared project. Here
https://stackoverflow.com/questions/25885238/xamarin-forms-listview-set-the-highlight-color-of-a-tapped-item/53079812#53079812

But the issue with it is, It is not working on just Tap when you release cursor/finger that time it is going show you appropriate color. It should be more easy so that people can do from xaml, In both ways when people clicking or releasing finger.
Thank you.

There is a proposed enhancement here (https://github.com/xamarin/Xamarin.Forms/pull/2050), but it is still in progress. Thanks!

this is so ridiculous that the color is still orange??? the workarounds are too complicated for a simple color change.

@android:color/transparent

@ElsaAM4Y please be so kind as to give me the full copy and paste, in the styles file?

I am trying to paste the code, but it comes out strange. But you go to Android project - resources - values - styles.xml. And then item name="android:colorActivatedHighlight">@android:color/transparent. You do this exactly like the line above between tags.

@ElsaAM4Y THANK YOU so much, your input was a great help, my selected item is now transparent which looks A BILLION times better than the hidious orange. question though say i wish to make it another color can i just say @android:color/pink ?

As ElsaAM4Y mentions above. Put the following in styles.xml:

<item name="android:colorActivatedHighlight">@android:color/transparent</item>

colorActivatedHighlight works for normal selection, but the list item turns another color (white for me) when active while showing the context action options (after doing the long press):

image

Is there another style for that state of the item?

Was this page helpful?
0 / 5 - 0 ratings