在style.xml里面写样式,如下
<style name="SplashTheme" parent="AppTheme">
<!--不在意变形的话直接用图片就是-->
<item name="android:windowBackground">@mipmap/first</item>
<!--全屏-->
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<!--去除状态栏-->
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<activity
android:name="com.eluton.first.FirstActivity"
android:launchMode="singleTask"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!--<data-->
<!--android:host="com.eluton.medclass"-->
<!--android:scheme="cundong" />-->
</intent-filter>
</activity>
然后如上图,修改AndroidManifest.xml,在第一个页面那里加入android:theme="@style/SplashTheme"就是。但上面也说了,直接用图片的话因为各种手机手机屏幕比例的问题,图片会变形。 <itemname="android:windowBackground">@mipmap/first</item>,Background嘛,就是说drawable什么的也能放进去,这样的话我们在drawable文件夹自定义一个layer_list,就叫layer_splash.xml吧,然后把@mipmap/first换成<itemname="android:windowBackground">@drawable/layer_splash</item>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#ffffff" />
</shape>
</item>
<!--android:bottom根据情况来定,ic_launcher一般换成自己app的logo图片,运行一遍就知道怎么修改了-->
<item
android:bottom="20dp"
android:drawable="@mipmap/ic_launcher"
android:gravity="center|bottom" />
</layer-list>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。