appWidget小应用----简易音乐播放器

这篇博客介绍了如何使用Android的appWidget功能创建一个简易音乐播放器。内容包括设计布局,实现AppWidgetProvider,声明appWidget,以及在服务中处理音乐播放功能,包括获取音乐文件和播放控制。
摘要由CSDN通过智能技术生成

制作一个类似与下图的简易音乐播放器
这里写图片描述

1.创建一个布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:paddingTop="4dp"
              android:paddingBottom="4dp"
              android:paddingLeft="8dp"
              android:paddingRight="8dp"
              android:orientation="horizontal"
              android:weightSum="5"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="0dp"
    android:layout_weight="3"
    android:layout_height="56dp">
    <TextView
        android:textSize="20sp"
        android:textStyle="bold"
        android:id="@+id/musicTitle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    <TextView
        android:textSize="18sp"
        android:layout_marginTop="3dp"
        android:text="artist"
        android:id="@+id/musicArtist"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</LinearLayout>
    <ImageView
        android:src="@drawable/ic_media_play"
        android:id="@+id/musicPlay"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="56dp"/>
    <ImageView
        android:src="@drawable/ic_media_next"
        android:id="@+id/musicNext"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="56dp"/>
</
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值