0

First of all, this is my code for style.xml:


  <style name="MainTheme" parent="MainTheme.Base">
      <item name="colorAccent">#FF4627</item>
  </style>
    <style name="MyTheme" parent="android:style/Theme.Material.Light.DarkActionBar">
        <item name="android:colorPressedHighlight">@color/ListViewSelected</item>
        <item name="android:colorLongPressedHighlight">@color/ListViewHighlighted</item>
        <item name="android:colorFocusedHighlight">@color/ListViewSelected</item>
        <item name="android:colorActivatedHighlight">@color/ListViewSelected</item>
        <item name="android:activatedBackgroundIndicator">@color/ListViewSelected</item>
        <item name="android:colorEdgeEffect">#FF4627</item>
    </style>
    <style name="splashscreen" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/MDPI</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">false</item>
        <item name="android:windowIsFloating">false</item>
        <item name="android:backgroundDimEnabled">true</item>
    </style>
    <color name="ListViewSelected">#E39696</color>
    <color name="ListViewHighlighted">#E39696</color>
</resources>

This is what I changed in MainActivity.cs:

    [Activity(Label = "Arboapp", Icon = "@drawable/ic_launcher", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]

This is my SplashActivity.cs:

[Activity(Label = "Arboapp", MainLauncher =true, Theme ="@style/splashscreen", NoHistory =true, Icon = "@drawable/icon")]
    public class SplashActivity : AppCompatActivity
    {
        

        protected override async void OnResume()
        {
            base.OnResume();
            StartActivity(typeof(MainActivity));

        }
        
    }

I then populated every mipmap folder (drawable included) with files of the correct resolution.

Even this way, the splas screen image I get is distorted.

enter image description here

Should be like this:

ToolmakerSteve
  • 18,547
  • 14
  • 94
  • 196
  • 1
    This question has been asked MANY times over the years. Please do a thorough google search before posting a question. (I've edited the title to the technically correct term for what is happening.) google `xamarin android splash screen image stretched`. One of the many Q&As: [Show splash screen image with auto fit](https://stackoverflow.com/questions/12607756/show-splash-screen-image-with-auto-fit) - I've picked that one because "auto-fit" is the term for what you want to happen. (fill without stretching). – ToolmakerSteve Jan 07 '22 at 20:42

1 Answers1

0

Image needs to be referenced only from drawable folder and other folders should have the images with exact same name.

Device will pick the correct folder and image in it based on the resolution You can check google document to get more details: https://developer.android.com/training/multiscreen/screendensities#TaskProvideAltBmp

And here is microsoft document about android splash screen: https://learn.microsoft.com/en-us/xamarin/android/user-interface/splash-screen

Adrain
  • 1,946
  • 1
  • 3
  • 7