<bitmap
android:gravity=“center”
android:src=“@drawable/icon_logo” />
icon_logo是一个图标,如果你的图标需要高像素的话,你就在res下新建一个drawable-xhdpi / drawable-xxhdpi。我是新建了一个drawable-xhdpi,至于这个图标你可以自己决定,没有的话就到我的源码里面去拿。下面进入到styles.xml中,在里面增加如下的代码:
下面再到AndroidMainfest.xml中设置样式。
到这一步,你再运行就不会有白屏了。启动后会一直停留在SplashActivity这里。
那么现在启动页和白屏就搞定了,我也不想让我的启动页这么枯燥,所以我要加一个动画的效果进去。首先进入activity_splash.xml。里面的代码如下:
<?xml version="1.0" encoding="utf-8"?><layout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
xmlns:tools=“http://schemas.android.com/tools”>
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:gravity=“center”
android:orientation=“vertical”
tools:context=“.ui.SplashActivity”>
<RelativeLayout
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginTop=“@dimen/dp_160”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Good Music”
android:textColor=“@color/white”
android:textSize=“@dimen/sp_24” />
<TextView
android:id=“@+id/tv_translate”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:background=“