I would like to customize UI of RangeSlider
. I have already a design of SeekBar
which now I want to convert to a RangeSlider
. I don't think using a library is reasonable for such a small task.
The result I want to achieve. See image of SeekBar
Seekbar Xml XML
<SeekBar
android:id="@+id/seek_bar_frost_hard_temperature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/custom_seekbar_frost_hard"
android:layout_marginTop="@dimen/margin_padding_size_small"
android:layout_marginBottom="@dimen/margin_padding_size_small"
android:max="11"
android:splitTrack="false"
android:maxHeight="@dimen/seek_bar_height"
android:paddingStart="@dimen/margin_padding_size_xsmall"
android:paddingEnd="@dimen/margin_padding_size_xsmall"
android:progress="0"
android:thumb="@drawable/seekbar_frost_hard_thumb"/>
custom_seekbar_frost_hard.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"
android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle"
android:tint="@color/frost_hard_seekbar_background_color">
<size android:height="@dimen/frost_seekbar_height" />
<solid android:color="@color/frost_hard_seekbar_background_color" />
</shape>
</item>
<item android:id="@android:id/progress"
android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
<selector>
<item android:state_enabled="false"
android:drawable="@android:color/transparent" />
<item>
<shape android:shape="rectangle"
android:tint="@color/frost_hard_seekbar_progress_color">
<size android:height="30dp" />
<solid android:color="@color/frost_hard_seekbar_progress_color" />
</shape>
</item>
</selector>
</scale>
</item>
</layer-list>
seekbar_frost_hard_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Background -->
<item>
<shape>
<solid android:color="@color/black"/>
<size
android:width="4dp"
android:height="@dimen/seekbar_thumb_frost_hard_height" />
</shape>
</item>
</layer-list>
question from:
https://stackoverflow.com/questions/65919894/rangeslider-with-custom-design-android 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…