Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使Seekbar拇指更容易抓取_Android_Touch_Seekbar - Fatal编程技术网

Android 使Seekbar拇指更容易抓取

Android 使Seekbar拇指更容易抓取,android,touch,seekbar,Android,Touch,Seekbar,所以我有一个SeekBar,但这个小圆圈拇指的东西有点难抓到。有没有办法让这个盒子更大?我不必在意图形本身是否有任何不同——我只想让它易于抓取。查看这个很酷的Seekbar库 并且可以通过以下方式添加,而无需太多复杂性 <org.adw.library.widgets.discreteseekbar.DiscreteSeekBar android:layout_width="match_parent" android:layout_height="wrap_

所以我有一个SeekBar,但这个小圆圈拇指的东西有点难抓到。有没有办法让这个盒子更大?我不必在意图形本身是否有任何不同——我只想让它易于抓取。

查看这个很酷的Seekbar库

并且可以通过以下方式添加,而无需太多复杂性

<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:dsb_min="2"
        app:dsb_max="15"
/>

库中的其他SeekBar组件是

您可以通过更改拇指的大小来自定义SeekBar。 使用形状作为占位符thumb_image.xml创建分层可绘制

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
    <shape>
        <size
            android:height="40dp"
            android:width="40dp" />

        <solid android:color="@android:color/transparent" />
    </shape>
</item>
<item android:drawable="@drawable/scrubber_control_normal_holo"/>
</layer-list>

下面的示例显示了结果

<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/thumb_image" />


这里是另一个很好的定制示例。

您需要一个插入式可绘制资源。对于“ShapeDrawable中的偏移形状”这一问题的答案恰好与您所问的是同一件事。与其他答案一样,如果目标drawable是私有的,则仍然需要复制它


优点(或缺点)是,这可以准确地显示您将大小增加了多少,而不是总大小。另外,我认为它可以节省内存,因为使用透明形状将创建一个大小为(?)的透明位图。

我曾尝试过该解决方案,但它找不到“洗涤器控制\u正常\u全息”您可以从这里下载必要的资源:然后将它们添加到您的可绘图文件夹。@KaliMa这是scriber\u control\u normal\u holo.png图像名称,只需使用简单较小的圆形图标,将其命名为scriber\u control\u normal\u holo并将其放入可绘图文件夹,然后使用上面的示例,如图所示,您将得到答案。试试看,如果它解决了你的问题,就让它得到回答。试着看看这个:它帮助了我:)
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/thumb_image" />