问题描述
最近我一直在做一个应用程序,它有一个搜索栏
。该搜索栏
是相当薄,因此,有时可能很难用它(你必须非常precise在你的手势)。有没有什么办法来增加的可触摸面积搜索栏
?所以,我希望用户能够触摸上方或下方的搜索栏
移动拇指。我AP preciate任何帮助,您可以提供!
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!
推荐答案
其中,最直接的方法是增加安卓值:填充
属性:
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.
您也可以使用这个库对于较复杂的 SeekBars
。
You can also use this library for more complex SeekBars
.
在此外,there你有一个很好的教程描述了一个自定义的搜索栏
的创作。
In addition, there you have a nice tutorial describing a custom SeekBar
creation.
这篇关于Android的搜索栏力度灵敏度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!