Android 音乐APP(二)启动白屏优化、定位当前播放歌曲(2)

<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=“

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值