Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.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未显示“完整”;拇指图标“;如果;高度“;设置为2dp或以下;包装“U内容”;_Android_Seekbar_Android Seekbar_Android Seek - Fatal编程技术网

Android SeekBar未显示“完整”;拇指图标“;如果;高度“;设置为2dp或以下;包装“U内容”;

Android SeekBar未显示“完整”;拇指图标“;如果;高度“;设置为2dp或以下;包装“U内容”;,android,seekbar,android-seekbar,android-seek,Android,Seekbar,Android Seekbar,Android Seek,在我的应用程序中,我使用的是带有自定义“拇指图标”和自定义“颜色”的SeekBar。根据要求,我将其高度设置为2dp,但在本例中,SeekBar未显示完整的“拇指图标”,当我将其高度设置为“包裹内容”时,它显示完整的“拇指图标”,但它也会将进度线高度增加到超出预期的程度。下面的图片清楚地解释了我的问题,请检查-- 下面是我的xml代码-- activity\u seek\u bar.xml <RelativeLayout xmlns:android="http://schemas.and

在我的应用程序中,我使用的是带有自定义“拇指图标”和自定义“颜色”的SeekBar。根据要求,我将其高度设置为2dp,但在本例中,SeekBar未显示完整的“拇指图标”,当我将其高度设置为“包裹内容”时,它显示完整的“拇指图标”,但它也会将进度线高度增加到超出预期的程度。下面的图片清楚地解释了我的问题,请检查--

下面是我的xml代码--

activity\u seek\u bar.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:background="@android:color/white"
    android:layout_height="match_parent"
    tools:context=".Activity.SeekBarTestActivity">

    <SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="match_parent"
        android:thumb="@drawable/sb_pointer"
        android:splitTrack="false"
        android:progress="50"
        android:progressDrawable="@drawable/progress_drawable"
        android:layout_height="wrap_content"
        android:layout_marginTop="90dp" />

</RelativeLayout>
<?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>
            <solid
                android:color="#3a3a3a" />
        </shape>
    </item>

    <item
        android:id="@android:id/progress">
        <clip>
            <shape>
                <solid
                    android:color="@color/media_action_color" />
            </shape>
        </clip>
    </item>

</layer-list>

progress\u drawable.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:background="@android:color/white"
    android:layout_height="match_parent"
    tools:context=".Activity.SeekBarTestActivity">

    <SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="match_parent"
        android:thumb="@drawable/sb_pointer"
        android:splitTrack="false"
        android:progress="50"
        android:progressDrawable="@drawable/progress_drawable"
        android:layout_height="wrap_content"
        android:layout_marginTop="90dp" />

</RelativeLayout>
<?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>
            <solid
                android:color="#3a3a3a" />
        </shape>
    </item>

    <item
        android:id="@android:id/progress">
        <clip>
            <shape>
                <solid
                    android:color="@color/media_action_color" />
            </shape>
        </clip>
    </item>

</layer-list>

我做了很多谷歌搜索,但不幸的是到目前为止没有结果,这就是为什么我需要你们专家的一些指导。此外,请让我知道,如果我可以提供更多的细节相同。谢谢。

使用

    android:layout_height="wrap_content"
    android:maxHeight="2dp"
使用