java - Android闪屏跳转java
问题描述
我想以正确的方式实现启动屏幕 - 没有表面延迟,仅在应用程序执行一些实际工作时显示它。所以我搜索了很多并找到了以下解决方案:我将主题应用于 SplashActivity,处理逻辑并打开下一个活动。问题是闪屏有点跳。尝试了不同的选项 - 全屏,没有用于启动的操作栏,没有用于启动和跟随活动的操作栏,android:windowDrawsSystemBarBackgrounds true\false 和其他几个。如果我将延迟设置为 115-150 毫秒,那么 10 个案例中有 9 个没有跳跃。问题是如何摆脱跳跃并保持初始屏幕精简。
飞溅活动:
public class SplashActivity extends CheckForInternetActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
routeActivity();
}
安卓清单:
<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>
样式.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
解决方案
推荐阅读
- java - Different instances of an object with a Session or Application scope in JEE7
- c# - Wait for Controller Action to be Called in MVC Method
- ruby - 计算字符频率时如何在ruby中格式化方法输出
- angular - Angular 和 Typescript 中的模型。类、子类和接口
- r - 计算分组行集中经过的时间
- sqlite - 从 pysqlite 中的 sqlite 访问点 cli 命令
- objective-c - Swift UIButton(内部框架)在ObjectiveC中不采取行动
- python-3.x - 使用 seaborn 在一个面板上绘制不同特征的分布图
- android - Android 9 在没有互联网的情况下断开 WiFi 连接
- c# - 如何使用 LIKE 和 %% 运算符在 Web 表单中查询和过滤我的数据?