gpt4 book ai didi

android - 如何在 Splashscreen API 中删除我的启动画面图标周围的圆形 mask ?

转载 作者:行者123 更新时间:2023-12-04 23:42:12 28 4
gpt4 key购买 nike

我有一个单一的 Activity 应用程序,我正在使用 SplashScreen API。我为我的图标使用了一个可绘制的图层列表,但它周围似乎有一个圆形框架。我试过只使用图标的 png 文件,但我仍然遇到同样的问题。
样式.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>
安卓 list
<?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()
}

最佳答案

这并不理想,但我使用 Asset Studio 将初始屏幕图形导入为自适应图标。在 Asset Studio 中,我将图标缩小到显示的安全区域内,然后它在我的初始屏幕上看起来正确。我搜索了同样的东西,但找不到改变图标形状或大小以使其更大的方法。虽然我没有看到谷歌对此的任何明确声明,但共识似乎是目标是为所有应用程序提供一致的启动屏幕体验,因此 Android 不支持圆形掩码之外的图标。他们确实声明here但是,图标前景的 1/3 被遮盖了。

关于android - 如何在 Splashscreen API 中删除我的启动画面图标周围的圆形 mask ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69510980/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com