Ham*_*had 18 android android-studio
在 23 中,我们默认定义了这些样式,现在我必须以全屏启动启动画面
vlue/样式文件
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Run Code Online (Sandbox Code Playgroud)
v21样式文件:
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
Run Code Online (Sandbox Code Playgroud)
显现:
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".User_MainInterface"
android:label="@string/title_activity_user__main_interface"
android:theme="@style/AppTheme.AppBarOverlay"></activity>
Run Code Online (Sandbox Code Playgroud)
请帮我快速解决这个问题
meo*_*w2x 23
如果您在为Android 12实现新的SplashScreen API时遇到此错误,请不要忘记:installSplashScreen
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
Run Code Online (Sandbox Code Playgroud)
不要忘记在之前 添加此内容setContentView()。
小智 13
万一对任何人都有用。
如果你正在使用androidx.core:core-splashscreen并且出现这个错误,对我来说,使用 kotlin,有效的是:
在方法中installSplashScreen()之前调用。super.onCreate(savedInstanceState)onCreate
输入import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
它应该类似于:
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
//other methods
}
Run Code Online (Sandbox Code Playgroud)
只需更改 android:theme="@style/AppTheme.NoActionBar"为 android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"全屏即可
| 归档时间: |
|
| 查看次数: |
6268 次 |
| 最近记录: |