1

In my app, I'm using SeekBar with custom "thumb icon" and custom "color". As per the requirement, I set it's height to 2dp, but in this case SeekBar not showing complete "thumb icon" and when I set it's height to "wrap_content", it shows complete "thumb icon" but it also increases the progress line height beyond the expectation. Below is the image which clearly explain my problem, please check--

enter image description here

Below is my xml code--

activity_seek_bar.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:background="@android:color/white"
    android:layout_height="match_parent"
    tools:context=".Activity.SeekBarTestActivity">

    <SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="match_parent"
        android:thumb="@drawable/sb_pointer"
        android:splitTrack="false"
        android:progress="50"
        android:progressDrawable="@drawable/progress_drawable"
        android:layout_height="wrap_content"
        android:layout_marginTop="90dp" />

</RelativeLayout>

progress_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape>
            <solid
                android:color="#3a3a3a" />
        </shape>
    </item>

    <item
        android:id="@android:id/progress">
        <clip>
            <shape>
                <solid
                    android:color="@color/media_action_color" />
            </shape>
        </clip>
    </item>

</layer-list>

I did a lot of google search but unfortunately no result so far and that's why I need some guidance from you experts. Also, please let me know if I can provide more details for the same. Thank you.

Hasan Kucuk
  • 2,433
  • 6
  • 19
  • 41
Dnyanesh M
  • 1,349
  • 4
  • 18
  • 46

1 Answers1

0

use

    android:layout_height="wrap_content"
    android:maxHeight="2dp"