SeekBar cannot select maximum value

in my xml layout I have a SeekBar like this:

        <SeekBar
                android:id="@+id/nbackPrefSeekBar"
                android:layout_height="wrap_content"
                android:layout_width="fill_parent"
                android:max="@integer/maxnback"
        />

The problem is that the user cannot select the maximum value using the pointer (by clicking, dragging and dropping ...). You can manually focus the Seekbar using the keys (up, down) and set it to the maximum value (right key). Using your finger, you can only select max-1.

eg. if you have a maximum value of 3, you can choose only 0, 1 and 2 (and with keys even 3). He always selects the value to the left of your finger, and therefore the maximum value cannot be selected as it is on the very right side of the arrow.

I actually tried to change the width parameter programmatically before displaying (hoping that you could choose the most correct value if you could drag it to the desired point), but I was stuck on getWidth () that returns 0.

The problem arises on each tested platform: 1.5, 1.6, 2.3 and on a real 2.1 device.

Any clues? Thank.

+3
source share
1 answer

This may be a long shot, but I see what you are using fill_parentin width. I am wondering if you have problems with the "fat fingers" of the end of the touch screen. Try adding the following to your XML file and see if you can then select the maximum value.

android:layout_margin="50"
+7
source

Source: https://habr.com/ru/post/1789139/


All Articles