Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SeekBar Touch Sensitivity

Recently I have been working on an app which has a SeekBar. The SeekBar is rather thin so it can at times be difficult to use it (you have to be very precise in your gestures). Is there any way to increase the touchable area of the SeekBar? So I want users to be able to touch above or below the SeekBar to move the thumb. I'd appreciate any help you can offer!

like image 946
Zero Avatar asked May 15 '13 06:05

Zero


People also ask

How to handle SeekBar in android?

A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Placing focusable widgets to the left or right of a SeekBar is discouraged. Clients of the SeekBar can attach a SeekBar.


1 Answers

One of the most straightforward approaches is to increase a value of the android:padding attribute:

<SeekBar
    android:id="@+id/yourSeekBar"
    android:progressDrawable="@drawable/seekbar_progress"
    android:thumb="@drawable/seekbar_thumb"
    android:paddingTop="@dimen/your_topPadding"
    android:paddingBottom="@dimen/your_bottomPadding" />

Another possibility: make a custom thumb and increase its background's size by adding e.g. transparent border.

You can also use this library for more complex SeekBars.

In addition, there you have a nice tutorial describing a custom SeekBar creation.

like image 131
mmBs Avatar answered Nov 15 '22 19:11

mmBs