【发布时间】:2022-12-20 16:05:06
【问题描述】:
我正在尝试将新的 Android 动画启动画面添加到我的应用程序,但是它没有显示。
主题.xml:
...
<style name="Theme.MySplash" parent="Theme.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@drawable/news_avd_v02</item>
<item name="postSplashScreenTheme">@style/Theme.xxx.NoActionBar</item>
<item name="windowSplashScreenIconBackgroundColor">@color/pink_300</item>
<item name="windowSplashScreenAnimationDuration">3000</item>
<!-- Status bar and Nav bar configs -->
<item name="android:statusBarColor">@color/black</item>
<item name="android:navigationBarColor">@color/black</item>
<item name="android:windowLightStatusBar">false</item>
</style>
...
安卓清单.xml:
<application
...
android:theme="@style/Theme.MySplash">
<activity
android:name=".MainDrawerActivity"
...
android:theme="@style/Theme.MySplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
...
MainDrawerActivity.kt:
...
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
...
class MainDrawerActivity : AppCompatActivity() {
...
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
...
我已经尝试终止该应用程序并重新启动它,它仍然没有显示动画。
【问题讨论】:
标签: android splash-screen android-12