由于最近自己在做一个音乐APP,在播放音乐时,想实现网易云那种带光盘和指针的界面,所以在慕课上找了学习教程,以下是我的学习过程,先放出网易云播放界面
1.隐藏statusBar
//隐藏statusBar,第一个参数是新窗口的标志位,第二个参数时要修改的标志位
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
2.布局文件(暂时添加返回按钮、背景、歌名和作者)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.PlayMusicActivity">
<ImageView
android:id="@+id/iv_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/album1"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/no_bar_back"
android:layout_margin="@dimen/marginSize"
android:onClick="onBackClick"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:layout_marginTop="480dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="音乐名称"
android:textColor="@android:color/white"
android:textSize="@dimen/textSize"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/marginSize"
android:textSize="@dimen/infoSize"
android:text="作者"
android:textColor="@android:color/white"/>
</LinearLayout>
</FrameLayout>