安卓-音乐播放器遇到问题和代码进展(逐渐更新)

Q:

RadioGroup用途:


RadioButton和CheckBox的区别:

1、单个RadioButton在选中后,通过点击无法变为未选中

    单个CheckBox在选中后,通过点击可以变为未选中

2、一组RadioButton,只能同时选中一个

     一组CheckBox,能同时选中多个

3、RadioButton在大部分UI框架中默认都以圆形表示

     CheckBox在大部分UI框架中默认都以矩形表示

RadioButton和RadioGroup的关系:

1、RadioButton表示单个圆形单选框,而RadioGroup是可以容纳多个RadioButton的容器

2、每个RadioGroup中的RadioButton同时只能有一个被选中

3、不同的RadioGroup中的RadioButton互不相干,即如果组A中有一个选中了,组B中依然可以有一个被选中

4、大部分场合下,一个RadioGroup中至少有2个RadioButton

5、大部分场合下,一个RadioGroup中的RadioButton默认会有一个被选中,并建议您将它放在RadioGroup中的起始位置





首先是布局界面也就是Activity_main.xml它的代码如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/skin_bg"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <!--第一行标题栏-->
    <TextView
        android:id="@+id/tv_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="本地音乐库"
        android:textSize="25dp"
        android:textColor="#ffffff"/>
    <!--线性布局一个-->
    <LinearLayout
        android:id="@+id/control_layout"
        android:layout_width="match_parent"
        android:layout_height="65dp"
        android:layout_below="@id/tv_title"
        android:orientation="horizontal">

        <Button
            android:id="@+id/btn_previous"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:layout_weight="1"
            android:background="@mipmap/main_btn_previous"
           />

        <Button
            android:id="@+id/btn_play_pause"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:background="@mipmap/main_btn_pause"
            android:layout_weight="1"
            />
     <!--   android:background="@mipmap/btn_shuffle-->

        <Button
            android:id="@+id/btn_next"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:layout_weight="1"
            android:background="@mipmap/main_btn_next"
         />


    </LinearLayout>


	<!--底部控制栏-->
    <RelativeLayout
        android:id="@+id/main_bottom_layout"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_alignParentBottom="true"
        android:layout_weight="1"
        >
        <LinearLayout
            android:id="@+id/main_bottom_click"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_toLeftOf="@+id/btn_main_bottom_detail"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/main_bottom_image"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:src="@mipmap/music_bottom" />

            <LinearLayout
                android:id="@+id/main_bottom_v"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_toRightOf="@+id/main_bottom_image"
                android:layout_toLeftOf="@+id/btn_main_bottom_detail"
                android:orientation="vertical"
                >

                <TextView
                    android:id="@+id/tv_bottom_title"
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:text="音乐的标题"
                    android:textColor="#ffffff"
                    android:layout_weight="1"/>
                <TextView
                    android:id="@+id/tv_bottom_artist"
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:textColor="#ffffff"
                    android:text="音乐的歌手"
                    android:layout_weight="1"/>
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:orientation="horizontal">
                    <TextView
                        android:id="@+id/tv_bottom_currentTime"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:text="当前时间"
                        android:textColor="#ffffff"
                        android:layout_weight="1"/>
                    <TextView
                        android:id="@+id/tv_botton_durationTime"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_marginLeft="10dp"
                        android:textColor="#ffffff"
                        android:text="总时间"
                        />
                </LinearLayout>

            </LinearLayout>
        </LinearLayout>


        <Button
            android:id="@+id/btn_main_bottom_detail"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="详细信息"
            android:textColor="#ffffff"
            android:layout_alignParentRight="true"
            />
    </RelativeLayout>


    <ListView
        android:id="@+id/lv_musicList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="true"
        android:layout_below="@+id/control_layout"
        android:layout_above="@+id/main_bottom_layout"
        >
    </ListView>
</RelativeLayout>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值