How do I remove circular mask around my splashscreen icon in Splashscreen API?

Viewed 1240

I have a single activity application and I'm using the SplashScreen API. I use a layer-list drawable for my icon, but there appears to be a circular frame around it. I have tried using just the png file of the icon but i still have the same issue.

styles.xml

<style name="Theme.App.Starting" parent="Theme.SplashScreen">
        // Set the splash screen background, animated icon, and animation duration.
        <item name="windowSplashScreenBackground">@color/sailor_blue</item>

        // Use windowSplashScreenAnimatedIcon to add either a drawable or an
        // animated drawable. One of these is required.
        <item name="windowSplashScreenAnimatedIcon">@drawable/splash_screen_layer_list</item>

        // Set the theme of the Activity that directly follows your splash screen.
        <item name="postSplashScreenTheme">@style/Theme.SimpleCrypto.NoActionBar</item>
    </style>

splash_screen_layer_list.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/sailor_blue" />
    <item
        android:drawable="@drawable/simple_crypto_logo"
        android:gravity="center" />
</layer-list>

Android Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.decagon.anietie.simplecrypto" >

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.SimpleCrypto"
        android:name=".SimpleCryptoApplication">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustResize"
            android:resizeableActivity="true"
            android:theme="@style/Theme.App.Starting"
            tools:targetApi="24" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>

</manifest>

And this is my MainActivity file

MainActivity.kt

class MainActivity : AppCompatActivity() {

    private lateinit var appBarConfiguration: AppBarConfiguration
    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // Handle the splash screen transition.
        val splashScreen = installSplashScreen()

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        setSupportActionBar(binding.appBarMain.toolbar)

        val navController = findNavController(R.id.nav_host_fragment_content_main)
        binding.navView?.let {
            appBarConfiguration = AppBarConfiguration(
                setOf(
                    R.id.nav_home, R.id.nav_converter, R.id.nav_wallet, R.id.nav_settings
                ),
                binding.drawerLayout
            )
            setupActionBarWithNavController(navController, appBarConfiguration)
            it.setupWithNavController(navController)
        }

        binding.appBarMain.contentMain.bottomNavView?.let {
            appBarConfiguration = AppBarConfiguration(
                setOf(
                    R.id.nav_home, R.id.nav_converter, R.id.nav_wallet
                )
            )
            setupActionBarWithNavController(navController, appBarConfiguration)
            it.setupWithNavController(navController)
        }

        onDestinationChangedListener()
    }
1 Answers

It is not ideal, but I imported my splash screen graphic as an adaptive icon using the Asset Studio. In asset studio, I zoomed my icon out until it was within the safe zones that are displayed, and then it looked correct on my splash screen. I searched for this same thing and was not able to find a way to change the icon shape or size to make it bigger. Although I did not see any explicit statement from Google on this, the consensus seems to be that the goal is to have a consistent splash screen experience for all applications so Android does not support icons outside of the circular mask that is there. They do state here that 1/3 of the icon foreground is masked, though.

Related