SeekBar doesn't react to user's touches

31 Views Asked by At

I neeed to handle user seekbar touches in AdapterRecyclerView, but the seekbar doesn't respond. I think the problem is that seekbar is in RecyclerView, and I don't know how to resolve this

holder.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if(mediaPlayer!=null && fromUser){
                mediaPlayer.seekTo(progress);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });

here xml code recyclerview's item. I have setOnClickListener on ImageView and it works. I have a swipe action on item recycler view and it also works

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
...
<SeekBar
    android:id="@+id/seek_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/date_note"
    android:visibility="invisible" />

<ImageView
    android:id="@+id/pause_play"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="3dp"
    android:background="@drawable/background_for_play_and_pause"
    android:src="@drawable/ic_baseline_play_arrow_24"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toTopOf="@id/seek_bar"/>
...
    </androidx.constraintlayout.widget.ConstraintLayout>
0

There are 0 best solutions below