启动画面有时会扭曲和模糊
Splash screen is sometimes distorted and blurred
我有一个启动画面 activity,主题如下:
<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 秒。然后,当我的启动画面 activity 达到 onCreate
时,主题看起来非常好。
问题来了:
您使用的是 gif 文件。在你说的给定时间后,2-3 秒它会覆盖屏幕尺寸,因此图像会变大。这就是它在屏幕上变得模糊的原因。
为您的商品添加 bottom
、left
、right
、top
尺寸。
将您的 drawble 文件更改为:
<?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>
这可能是缩放问题,请尝试更改启动画面的布局,而不是设计整个图像并将其设置为背景,而是将您的布局设计为具有两个图像,一个用于灰色矩形,另一个用于视频图标
我有一个启动画面 activity,主题如下:
<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 秒。然后,当我的启动画面 activity 达到 onCreate
时,主题看起来非常好。
问题来了:
您使用的是 gif 文件。在你说的给定时间后,2-3 秒它会覆盖屏幕尺寸,因此图像会变大。这就是它在屏幕上变得模糊的原因。
为您的商品添加 bottom
、left
、right
、top
尺寸。
将您的 drawble 文件更改为:
<?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>
这可能是缩放问题,请尝试更改启动画面的布局,而不是设计整个图像并将其设置为背景,而是将您的布局设计为具有两个图像,一个用于灰色矩形,另一个用于视频图标