网易云音乐是一款非常优秀的音乐软件,它的播放界面由唱片机组成,显得非常的古朴典雅。
现在我们就用AndirdStudio来实现这个任务:
效果图
第一步:创建一个新的项目,例如wymusicdemo12
第二步:在java目录下的第一个文件夹下建立3个包文件
adapter、entity和fragment
第三步:建立布局文件music_item
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/music_item_bmg"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/ic_launcher"/>
<TextView
android:id="@+id/music_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="成都"/>
<TextView
android:id="@+id/music_item_artist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="赵雷"
android:layout_gravity="bottom"
/>
</LinearLayout>
第四步写主函数的布局文件
``
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="horizontal"
tools:context="com.example.user.wymusicdemo1.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:id="@+id/mian_local_tv"
android:layout_width=