我有一个单一活动的应用程序,我正在使用SplashScreen API。我为我的图标使用了一个图层列表drawable,但它周围似乎有一个圆形的框架。我试着只使用图标的png文件,但我仍然有同样的问题。
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" />
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>
而这是我的MainActivity文件
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()