Answer the question
In order to leave comments, you need to log in
How to implement stop and play buttons?
Good evening! the fact is that in my player I need to implement the play / stop function, the play button is standard, it is necessary that when you click on it, the song stops and instead of the play button, stop appears, that is, the buttons change according to their state, Thank you in advance for your answer!
Answer the question
In order to leave comments, you need to log in
I would use a ToggleButton with a custom selector and put a listener on it .
ToggleButton :
<ToggleButton
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/toggle_playback"
android:textOff="@null"
android:textOn="@null" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_playback_stop" android:state_checked="true" />
<item android:drawable="@drawable/ic_playback_play" android:state_checked="false" />
</selector>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question