Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.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 如何制作带有指示器图像的自定义进度条,如whatsapp?_Android_Android Progressbar_Whatsapp - Fatal编程技术网

Android 如何制作带有指示器图像的自定义进度条,如whatsapp?

Android 如何制作带有指示器图像的自定义进度条,如whatsapp?,android,android-progressbar,whatsapp,Android,Android Progressbar,Whatsapp,我在res->drawable文件夹中创建了一个名为customprogressbar.XML的XML文件: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Define the background properties like color etc --> <item android:id="@android:id/background"&

我在res->drawable文件夹中创建了一个名为customprogressbar.XML的XML文件:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Define the background properties like color etc -->
    <item android:id="@android:id/background">
    <shape>
        <gradient
                android:startColor="#000001"
                android:centerColor="#0b131e"
                android:centerY="1.0"
                android:endColor="#0d1522"
                android:angle="270"
        />
    </shape>
   </item>

  <!-- Define the progress properties like start color, end color etc -->
  <item android:id="@android:id/progress">
    <clip>
        <shape>
            <gradient
                android:startColor="#007A00"
                android:centerColor="#007A00"
                android:centerY="1.0"
                android:endColor="#06101d"
                android:angle="270"
            />
        </shape>
    </clip>
    </item>
</layer-list>


现在我有颜色,但我需要把指示器图像,在填充和保留之间


有什么想法吗?

您看到的是一个Seekbar,而不是一个普通的进度条。圆圈指示器称为拇指,您可以添加任何喜欢的图像(以及自定义进度条)


如果“指示器图像”是指圆形,那么我不确定ProgressBar是否可以实现这一点

在我看来,这更像是一个SeekBar,而不是ProgressBar。除了SeekBar具有“thumb”属性外,它们实际上是相同的。这可能对您有用:

<SeekBar
   android:id="@+id/seekBar"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:thumb="@drawable/thumb_image"
   android:progressDrawable="@drawable/customprogressbar.xml"
/>


您认为指示器图像具体是什么?哪个指示器代表什么?如果你看到屏幕截图,你可以看到填充和保留之间的一点。非常感谢。太好了。我要做一个定制的seekBar
<SeekBar ...
    android:thumb="@drawable/your_thumb"
    android:progressDrawable="@drawable/progress_bar_layers"
 />
<SeekBar
   android:id="@+id/seekBar"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:thumb="@drawable/thumb_image"
   android:progressDrawable="@drawable/customprogressbar.xml"
/>