智能终端课程设计之安卓音乐播放器
这里是一个最基本最简单的本地音乐播放器,应付课设基本就OK了。
不要脸😀的把项目扔上来:https://github.com/Chuyuxuan0v0/AndroidMusic
课设题目要求
========================================================
题目九 音乐播放器
一、目的与要求
- 学会如何使用 MediaPlayer 等媒体播放组件。 2. 学会如何进行数据保存。
音乐播放器主要的功能: - 播放列表:在设置菜单,读取 sdcard 指定目录下的所有 mp3 文件,建立播放列表。
- 播放控制:能够对播放进行控制,能够开始/继续播放、暂停播放、停止播放、上一 首、下一首。
- 保存播放记录:能够存储已播放过的历史。
- 扩展功能:(1)增加歌曲库的概念;(2)给歌曲设置类别标签,根据已播放的历 史,在界面上的推荐区域展示推荐歌曲;(3)根据歌名,搜索下载网上的歌曲。
==========================================================
界面展示
实现方法
1、layout_main文件编写
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/welcomimg1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:id="@+id/local_music_bottomlayout">
<!-- android:background="#33EEEEEE"-->
<ImageView
android:layout_width="match_parent"
android:layout_height="0.5dp"/>
<!-- android:background="#9933FA"-->
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/music1"
android:layout_centerVertical="true"
android:background="@mipmap/a1"
android:layout_marginLeft="10dp"
android:id="@+id/local_music_bottom_iv_icon"/>
<TextView
android:id="@+id/local_music_bottom_tv_song"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_toRightOf="@id/local_music_bottom_iv_icon"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textSize="10sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/local_music_bottom_tv_singer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="8sp"
android:layout_below="@id/local_music_bottom_tv_song"
android:layout_alignLeft="@id/local_music_bottom_tv_song"
android:layout_marginTop="10dp"/>
<ImageView
android:id="@+id/local_music_bottom_iv_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@mipmap/play_next"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"/>
<ImageView
android:id="@+id/local_music_bottom_iv_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@mipmap/play"
android:layout_toLeftOf="@id/local_music_bottom_iv_next"
android:layout_marginRight="20dp"/>
<ImageView
android:id="@+id/local_music_bottom_iv_last"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@mipmap/play_front"
android:layout_toLeftOf="@id/local_music_bottom_iv_play"
android:layout_marginRight="20dp"/>
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/local_music_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/local_music_bottomlayout">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
2、layout_welcome文件编写
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/welcommig1">
<TextView
android:id="@+id/tc1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="197dp"
android:layout_marginEnd="139dp"
android:fontFamily="sans-serif-condensed-medium"
android:text="BUG Player"
android:textColor="#FDFCFC"
android:textSize="28dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tc1"
android:layout_alignParentLeft="true&#