如何在圆形进度条内设置图像按钮(圆圈)

时间:2017-03-14 13:29:52

标签: java android xml layout

我是XML语言的新手,并且不知道如何将ImageButton置于循环progress bar内,并且如果可能的话,也不知道如何。

1 个答案:

答案 0 :(得分:0)

没有。如果要自定义ProgressBar,则需要设置Styleandroid:progressDrawable

<ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleHorizontal"
    android:progressDrawable="@drawable/custom_progressbar"         
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

然后你可以创建Layer-List Drawable或任何其他drawable。

<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>

结帐this