Android启动图不拉伸且宽占满屏幕
一般启动图的做法:
start_app_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><item><shape><solid android:color="@color/c_af928c"/></shape></item><item><bitmap android:src="@mipmap/start_btm_bg"android:gravity="center_horizontal|bottom"/></item><itemandroid:top="@dimen/d200px"><bitmap android:src="@mipmap/start_logo"android:gravity="center_horizontal|top"/></item>
</layer-list>
<style name="AppThemeGuide" parent="AppTheme"><item name="android:windowBackground">@drawable/start_app_bg</item></style>
使用:
<activityandroid:name=".modules.loginregist.activity.StartupActivity"android:configChanges="orientation|keyboardHidden|keyboard|screenSize"android:exported="true"android:screenOrientation="portrait"android:theme="@style/AppThemeGuide"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity>
这样做出来的,一般@mipmap/start_btm_bg图片距离屏幕左右两边还有间距,不好看。
我的处理方案:让UI出个宽大点的图,然后把它放到低一个分辨率的mipmap-xxhdpi里面