Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SeekBar a maximal value cannot be selected

in my layout xml 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 the user cannot select the maximal value with use of pointer (by clicking, dragging...). It is possible by manually focus the Seekbar with keys (up,down) and set it to the maximal value (right key). Using your finger you can select only the max-1 value.

E.g. if you have max value 3, you can select only 0, 1 and 2 (and with keys even 3). It is always selecting the value left of your finger and therefore the max value cant be selected as it is on the rightest side of the seekbar.

I actually tried to modify the width parameter programatically before displaying (hoping that you would be able to select the rightest value if you were able to drag it past the rightest point), but i got stuck on getWidth() returning 0.

The problem occurs on each platform I tested: 1.5, 1.6, 2.3 and on real 2.1 device as well.

Any clues? Thanks.

like image 644
jaromiru Avatar asked Feb 25 '23 05:02

jaromiru


1 Answers

Maybe this is a long shot, but I see that you are using fill_parent on the width. I'm wondering if you are just having problems "fat-fingering" the end of the touch screen. Try adding the following to your XML file and see if you can then select the max value.

android:layout_margin="50"
like image 159
user432209 Avatar answered Mar 07 '23 02:03

user432209