我有一个闪屏活动,主题如下:
<style name="AppTheme.Launcher" parent="Theme.AppCompat.NoActionBar">
<item name="android:background">@drawable/splash_theme</item>
</style>
这是我的清单的一部分:
<activity
android:name=".activities.SplashActivity"
android:theme="@style/AppTheme.Launcher">
<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>
这是我的绘画:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/colorPrimaryDarkBackground" />
<item>
<bitmap
android:gravity="center"
android:src="@drawable/shelpwelt_theme" />
</item>
</layer-list>
在某些版本中,所有版本都可以完美运行,但有时启动画面会完全扭曲和模糊,但仅在前2-3秒。然后,当我的闪屏活动到达onCreate
时,主题看起来非常好。
添加bottom
,left
,right
,top
尺寸到您的项目。
将您的drawable文件更改为:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/colorPrimaryDarkBackground" />
<item
android:bottom="24dp"
android:left="24dp"
android:right="24dp"
android:top="24dp"
>
<bitmap
android:gravity="center"
android:src="@drawable/shelpwelt_theme" />
</item>
</layer-list>
您正在为此案例使用gif文件。在给定的时间后你说,2-3秒它包裹屏幕大小,所以图像变大。这就是它在屏幕上模糊的原因。
这可能是一个缩放问题,尝试更改splash的布局,而不是设计整个图像并将其设置为背景,设计您的布局以使两个图像一个用于灰色矩形,另一个用于视频图标