I've just discovered the seekbar discrete widget in android studio, i found it very usefull but i can't figure out how to remove the step indicators, or changing them with more appropriate drawables.
Did someone managed to do it?
Here's a screen of my current seekbar:
I'd like to change all the current step indicators, thank you.
EDIT:
Here's my current progress drawable:
<item android:id="@android:id/background" >
<shape >
<corners android:radius="20dp" />
<gradient
android:startColor="@color/Trasparente"
android:centerColor="@color/Trasparente"
android:centerX="1"
android:endColor="@color/Trasparente"
android:angle="0"
/>
</shape>
</item>
<item android:id="@android:id/progress" >
<clip android:clipOrientation="horizontal" android:gravity="left" >
<shape>
<corners android:radius="20dp" />
<gradient
android:startColor="@color/colorBluClima"
android:centerColor="@color/colorGreenServizi"
android:centerX="0.35"
android:endColor="@color/colorRossoErrore"
android:angle="0"
/>
</shape>
</clip>
</item>
and here's my seekbar in the layout:
<SeekBar
android:maxHeight="12dp"
style="@style/Widget.AppCompat.SeekBar.Discrete"
android:layout_width="812dp"
android:layout_height="100dp"
android:max="19"
android:id="@+id/SeekBarStufa220"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="90dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginEnd="90dp"
app:layout_constraintRight_toRightOf="parent"
android:paddingEnd="85dp"
android:paddingStart="85dp"
android:progressDrawable="@drawable/progress_seek_clima"
android:thumb="@drawable/ic_temprature"
app:layout_constraintVertical_bias="0.79"
android:progress="10" />
The thumb is a simple drawable
I was searching for same solution, but for Material Design Slider (com.google.android.material.slider.Slider
)
.
I don't know since this option is available (currently i'm using 'com.google.android.material:material:1.3.0'
), but if you use code below in your layout XML, ticks will disappear.
app:tickVisible="false"
I solved it creating a new style with SeekBar.Discrete as parent.
<style name="SeekBarWithoutSteps" parent="Base.Widget.AppCompat.SeekBar.Discrete">
<item name="tickMark">@null</item>
</style>
if you want want to use style, you can use below xml attribute for material sliders to hide the dots
app:tickColor="#00000000"
I was also searching for an answer to this but didn't find anything. I tried some things and found a style included in Android Studio (I am sure it will be also available in Eclipse and other IDEs) within the Discrete SeekBar options which is @android:style/Widget.DeviceDefault.Light.SeekBar
.
I tried it with an Android 5.1 device and it worked perfectly, but be careful cause there's one which could seem to be the same (called @android:style/Widget.Material.SeekBar.Discrete
) but it leaves the dots.
So I think that if the first one removes the dots from the SeekBar, it's the one you were looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With