How to make ascending (triangular) seekbar Android

Viewed 240

I'm stuck at making a triangular seekbar. Like it should be. I've seen so many seekbar's but they all same, horizontal with some little changes. But triangle seekbar I have never seen. Maybe someone faced this problem, maybe there are new solutions, for example, with the same Jetpack compose.

I was able to come to this decision I have now. But I really do not like it, there is almost no normal slider setting, as well as the thumb. And when using the sic bar itself, changing the thumb is very difficult or almost impossible, can someone tell me a normal solution :)

My solution is based on splitting the picture into 9 patches using Android studio. And then using that as android:progressDrawable="@drawable/rising_seekbar". So I'm interested in something more customizable and responsive, a code-based solution, I've never built custom views, so I have no idea how can I do it.

rising_seekbar.xml

<item android:id="@android:id/background">
    <nine-patch
        android:src="@drawable/slider_empty"
        android:dither="true"/>
</item>
<item android:id="@android:id/progress">
    <clip
        android:clipOrientation="horizontal"
        android:gravity="left">
        <nine-patch
            android:src="@drawable/slider_full"
            android:dither="true"/>
    </clip>
</item>

seekbar in layout

 <SeekBar
  android:id="@+id/text_size_sb"
  style="?android:attr/progressBarStyleHorizontal"
  android:layout_width="match_parent"
  android:layout_height="@dimen/margin_24dp"
  android:layout_marginStart="@dimen/margin_12dp"
  android:layout_marginTop="@dimen/margin_60dp"
  android:layout_marginEnd="@dimen/margin_12dp"
  android:max="64"
  android:thumb="@drawable/seek_bar_thumb"
  android:progressDrawable="@drawable/rising_seekbar"
  android:splitTrack="false"
  android:paddingStart="@dimen/margin_12dp"
  android:paddingEnd="@dimen/margin_12dp"
  android:progress="24" />

One of the problems link And it have many more because it is xml.

0 Answers
Related