Search code examples
xamarinxamarin.formsxamarin.android

How do I change the Xamarin.Forms Frame default selected border for Android?


When a Xamarin.Forms Frame is selected, the default Android color is orange. For example:

<Frame
  Margin="0"
  Padding="0"
  BackgroundColor="White"
  CornerRadius="8"
  HeightRequest="145"
  HorizontalOptions="Center"
  VerticalOptions="Center"
  WidthRequest="150" />

Default Xamarin.Forms Frame border for Android

How do I change this default color for my entire app?


Solution

  • Override the android:colorActivatedHighlight value in the Resources/values/styles.xml file in your Android project.

    Android styles file

    <?xml version="1.0" encoding="utf-8" ?>
    <resources>
      <style name="MainTheme" parent="MainTheme.Base">
        <!-- Sets Frame element border when selected -->
        <item name="android:colorActivatedHighlight">@android:color/transparent</item>
      </style>
      
      ...
    
    </resources>