簡體   English   中英

如何疊加播放和暫停按鈕?

[英]How to overlay play and pause button?

如何使我的暫停和播放按鈕彼此重疊? 這只是意味着,當我按下按鈕暫停時,將出現暫停按鈕,而當我再次按下按鈕時,將出現播放按鈕。

<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="#A9E2F3"
tools:context="${packageName}.${activityClass}" >



 <TextView
       android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:keepScreenOn="true"
        android:text="Audio Streaming"
        android:textSize="43sp" />   

    <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Play"
            android:id="@+id/button_play" android:layout_weight="1"
            android:drawableLeft="@android:drawable/ic_media_play"/>
    <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Pause"
            android:layout_alignTop="@id/button_play"
            android:layout_alignLeft="@id/button_play"
            android:id="@+id/button_pause" android:layout_weight="1"
            android:drawableLeft="@android:drawable/ic_media_pause"/>

             </RelativeLayout>

我什至不知道我是否使用了正確的布局,是相對布局,框架布局還是線性布局? 提前致謝!

單擊該按鈕時,只能使用一個按鈕作為切換按鈕,如果flag為true,則將其文本設置為play;如果flag為true,則將其文本設置為false,並將其文本設置為暫停等。

按照標志寫代碼,如果標志的編碼

享受編碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM