c0dehunter
c0dehunter

Reputation: 6150

Vertical SeekBar looks strange on some devices

I am trying to get vertical SeekBar to work on all devices. On some it is showing properly: enter image description here but on others not : enter image description here , enter image description here .

I made vertical SeekBar with this trick:

<Relative Layout
   ...
    <FrameLayout
        android:layout_width="18dp"
        android:layout_height="match_parent"
        android:layout_alignParentRight="true"
        android:orientation="vertical">

        <SeekBar
            android:id="@+id/seekbar_btn1"
            style="@style/Widget.AppCompat.SeekBar.Discrete"
            android:layout_width="90dp"
            android:layout_height="18dp"
            android:layout_gravity="center"
            android:background="@null"
            android:max="100"
            android:rotation="270"
            android:splitTrack="true"/>
</RelativeLayout>

The SeekBar's thumb position can be fixed if I set FrameLayout's layout_width and SeekBar's layout_height respectively (actual SeekBar's width) to a bigger value, but then the SeekBar gets too far from the right edge, which I don't want.

The SeekBar is included in a "button" view (16 of them in 4x4 Linear Layouts with weights) so I am not able to set SeekBar's layout_width (which is actually height) dynamically. I fixed the value to 90dp and I am wondering if this is the root cause of the problem and how I should tackle it.

How can I make the SeekBar look the same on different devices?

Upvotes: 1

Views: 212

Answers (0)

Related Questions