Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.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-自定义搜索栏-搜索栏底部不必要的空白_Android_Android Layout_Android Intent_Android Emulator_Android Widget - Fatal编程技术网

Android-自定义搜索栏-搜索栏底部不必要的空白

Android-自定义搜索栏-搜索栏底部不必要的空白,android,android-layout,android-intent,android-emulator,android-widget,Android,Android Layout,Android Intent,Android Emulator,Android Widget,我需要定制一个seekbar。为了实现这一点,我使用了一个层列表XML文件,然后将其设置为seekbar的背景。 对于@android:id/background我使用位图,对于secondaryProgress和progress,我使用形状。 这是XML背景文件: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/androi

我需要定制一个seekbar。为了实现这一点,我使用了一个
层列表
XML文件,然后将其设置为seekbar的背景。
对于
@android:id/background
我使用位图,对于
secondaryProgress
progress
,我使用形状。
这是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">
        <bitmap
            android:src="@drawable/progressbar_bg"
            android:tileMode="repeat" />

    </item>
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
                <solid android:color="#B2B2B2" />

                <corners android:radius="5dp" />
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <solid android:color="#E00072" />

                <corners android:radius="5dp" />
            </shape>
        </clip>
    </item>

</layer-list>

下面是我如何声明SeekBar的:

<SeekBar
                android:id="@+id/seekBar1"
                android:thumb="@drawable/progressbar_thumb"                
                android:progressDrawable="@drawable/custom_seek_bar"
                android:background="@drawable/progressbar_bg"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_toLeftOf="@id/video_total_time"
                android:layout_toRightOf="@id/video_time_played" />

问题是SeekBar高度并没有收缩到新的高度,我希望它和背景图像的高度相等。相反,我看到一个区域充满了空白


你知道空白是从哪里来的吗?如何消除它?

对于
@android:id/background
项,使用9补丁而不是位图解决了这个问题

 <item android:id="@android:id/background">
        <nine-patch
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:dither="true"
            android:src="@drawable/progressbar_backg" />
 </item>

对某些解决方案也感兴趣:=))