Search code examples
androidxamarin.formsstyling

What is MainTheme.Base in a default Xamarin.Forms Android project?


I created a new Xamarin.Forms application. My Android project contains a styles.xml file with the following contents:

<?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="MainTheme" parent="MainTheme.Base">
    <!-- As of Xamarin.Forms 4.6 the theme has moved into the Forms binary -->
    <!-- If you want to override anything you can do that here. -->
    <!-- Underneath are a couple of entries to get you started. -->

    <!-- Set theme colors from https://aka.ms/material-colors -->
    <!-- colorPrimary is used for the default action bar background -->
    <!--<item name="colorPrimary">#2196F3</item>-->
    <!-- colorPrimaryDark is used for the status bar -->
    <!--<item name="colorPrimaryDark">#1976D2</item>-->
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <!--<item name="colorAccent">#FF4081</item>-->
  </style>
</resources>

As I understand it, this allows me to create my own theme for my app, and my theme inherits the MainTheme.Base theme. My question is - what is MainTheme.Base? Where can I see it defined? I'm expecting to see something like parent="android:style/Theme" as used here: https://www.tutorialspoint.com/android/android_styles_and_themes.htm


Solution

  • MainTheme.Base is a built-in theme style, and you can see it in the source code. For more details, please check this link