Android SeekBar问题

Android SeekBar问题,android,android-progressbar,Android,Android Progressbar,我想做到这一点: 此时此刻,我正处于 我的问题是,我想去掉“蒙坦德蒙德”和西格巴之间的空间。这不是因为上边距或填充,因为我没有设置任何上/下边距或填充 其次。如何在seekbar拇指下方设置该条,以便拇指可以在垂直条上移动 对于seekbar,我使用自定义xml背景。代码如下所示 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res

我想做到这一点:

此时此刻,我正处于

我的问题是,我想去掉“蒙坦德蒙德”和西格巴之间的空间。这不是因为上边距或填充,因为我没有设置任何上/下边距或填充

其次。如何在seekbar拇指下方设置该条,以便拇指可以在垂直条上移动

对于seekbar,我使用自定义xml背景。代码如下所示

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape>
            <gradient
            android:startColor="#ffffffff"
                android:centerColor="#ffdddddd"
                android:centerY="0.20"
                android:endColor="#ffffffff"
                android:angle="270"/>

            <padding android:left="1dp"
            android:top="1dp"
            android:right="1dp"
            android:bottom="1dp"/> 
        <corners android:radius="1dp"/> 
    </shape>
</item>



<item android:id="@android:id/progress">
    <clip>
       <shape>
            <gradient
                    android:startColor="#ff0e75af"
                    android:endColor="#ff1997e1"
                    android:angle="90" />
            <padding android:left="1dp"
                android:top="1dp"
                android:right="1dp"
                android:bottom="1dp"/> 
            <corners android:radius="1dp"/> 
        </shape>
    </clip>
    </item>
</layer-list>

在my main.xml中,seekbar具有以下属性

<SeekBar
            android:id="@+id/seekvalue"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/eight_dp"
            android:layout_marginRight="@dimen/eight_dp"
            android:background="@color/fulll_transparent"
            android:indeterminate="false"
            android:max="48500"
            android:maxHeight="12dip"
            android:minHeight="5dp"
            android:paddingLeft="@dimen/twenty_sp"
            android:paddingRight="@dimen/ten_dp"
            android:progressDrawable="@drawable/progressbar"
            android:thumb="@drawable/slider"
            android:thumbOffset="-1px" />

你需要使用透明的img,img中不应该有任何填充。我认为你的img角是透明的,所以它会占用空间。基本上你需要使用五个img

1.seekbartotal background
2.seekbar played background
3.seekbar buffered backgroung
4.seekbar thumb and finally 
5.seekbar thumb focus

进一步查看,希望这将对您有所帮助。

将maxHeight和minHeight值设置为相同,并根据将拇指放在进度线上的位置来增加或减少这两个值。

请尝试,但很抱歉,它会更改进度条。空间仍然存在很好,如果这对你有帮助,那么接受它,这样其他人就会从这个答案中受益。我还没有找到解决方案。根据你说的,我需要使用progressbar和seekbar,在seekbar中,将进度高度设置为0或透明,然后移动拇指并在进度栏上设置进度,是吗?按照我的回答中维护的链接进行操作。你能根据我的问题在这里给我举个例子吗?请正确阅读博客所有内容,然后询问你有什么困难