I use a Seekbar in the middle of two layers with different background colors.
In normal state it's OK. here's the picture:
When holding down the Seekbar, it has a wrong background in the top half:
Here is the code in layout file:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout ...
android:background="#23232C"
tools:context=".MainActivity">
<android.support.constraint.ConstraintLayout
android:id="@+id/player"
android:layout_width="0dp"
android:layout_height="56dp"
android:background="#2F2F38"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/imageViewAlbumArt">
<!-- ... some views ...-->
</android.support.constraint.ConstraintLayout>
<SeekBar
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:id="@+id/seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/player"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/player" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/player"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
I found that the problem is that when Seekbar is above any view the background not shown. Here's the simple layout that show the case:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#3b3930" />
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp" />
</FrameLayout>
I follow the instruction in this stackoverflow link and this is the result:
Is there anyway to remove the default background color behavior?
I gave background color to the bottom view and seekbar background color behavior gone.
The only solution for know.