如何解决安卓闪屏跳转java
我想以正确的方式实现启动画面 - 没有表面延迟,只在应用程序执行一些实际工作时显示它。所以我用谷歌搜索了很多并找到了以下解决方案:我将主题应用于 SplashActivity,处理逻辑并打开下一个活动。问题是闪屏有点跳跃。尝试了不同的选项 - 全屏,没有用于启动的操作栏,没有用于启动和跟随活动的操作栏,android:windowDrawsSystemBarBackgrounds true\false 和其他几个。如果我将延迟设置为 115-150 毫秒,那么 10 次中有 9 次没有跳跃。问题是如何摆脱跳跃并保持启动画面精益。
飞溅活动:
public class SplashActivity extends CheckForInternetActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
routeActivity();
}
AndroidManifest:
<activity
android:name="ru.awac.CBoRrates.SplashActivity"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity"
android:theme="@style/AppTheme.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
styles.xml:
<style name="AppTheme.SplashScreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
启动画面:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@android:color/white"/>
<item>
<bitmap
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:layout_margin="5dip"
android:src="@drawable/awac_presents_transparent_1" />
</item>
</layer-list>
awac_presents_transparent_1 只是一个 png
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。