Android初级,实现网易云音乐歌曲列表界面效果,播放界面效果,ListView,ViewPager方法详解

初学Android初级,第一篇博客文章,如有错误,还望批评指正!

本文主要内容以网易云音乐歌曲列表界面效果代码,播放音乐界面效果代码为主,并将ListView和ViewPager作为实现界面滑动功能的适配器控件进行穿插讲解。

读完本文你将了解到:

  • 如何创建布局文件(线性布局及相对布局搭配使用)
  • 如何使用ListView和ViewPager进行界面滑动和切换(Fragment)
  • 利用缓存原理给布局视图控件赋值
  • 如何将手机本地音乐导入到已编写运行好的程序中(多媒体Media)

Part1 效果图

最终效果图
图片列表界面图片播放界面

Part2 整体思路详解

1.创建实体类

  1. 在Java中分别创建三个包
    • fragment
    • adapter(适配器)
    • entity(实体类)
  2. 在实体类中创建java文件用于实体类(注意类名首字母大写)
  3. 定义需要的参数(title,album,artist,“Bitmap” albumBmp)
    若定义类型为private型则需要进行set,get方法的构建

2. 创建layout文件

用于歌曲列表样式布局**,代码如下:

<Linear Layout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

//运用相对布局文件
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="50dp">

//创建列表歌曲间的横线
        <View
            android:id="@+id/list_column_v"
            android:layout_width="0.5dp"
            android:layout_height="match_parent"
            android:visibility="visible"
            ></View>
//设置专辑图片样式
        <ImageView
            android:id="@+id/simple_cover_Iv"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignBottom="@+id/linearLayout"
            android:layout_marginStart="11dp"
            android:layout_toEndOf="@+id/list_column_v"
            android:src="@mipmap/default_cover" />
//运行线性布局文件进行TextView布局
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/simple_cover_Iv"
            android:orientation="vertical"
            android:layout_marginTop="5dp"
          
  • 10
    点赞
  • 111
    收藏
    觉得还不错? 一键收藏
  • 16
    评论
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值