【问题标题】:Arc Progress Bar with constant image inside内有恒定图像的弧形进度条
【发布时间】:2018-01-11 20:10:49
【问题描述】:

如何创建一个包含恒定图像的 Arc 进度条动画,就像这样

【问题讨论】:

标签: android android-animation android-progressbar


【解决方案1】:

如果您正在使用该库,请使用

 <com.github.lzyzsd.circleprogress.ArcProgress
    android:id="@+id/arc_progress"
    android:background="#214193"
    android:layout_marginLeft="50dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    custom:arc_progress="55"
    custom:arc_bottom_text="Required Text"/>

【讨论】:

    【解决方案2】:
    <?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
            android:innerRadiusRatio="3"
            android:shape="ring"
            android:thicknessRatio="12.0"
            android:useLevel="false">
            <bitmap android:src="@drawable/bg" />
        </shape>
    
    </item>
    
    <item android:id="@android:id/progress">
    
        <shape
            android:innerRadiusRatio="3"
            android:shape="ring"
            android:thicknessRatio="12.0">
            <gradient
                android:endColor="#cc44b9ff"
                android:startColor="#cc9730ff"
                android:type="linear" />
    
        </shape>
    
    </item>
    

    Layer List 是一种可绘制的类型,第一项表示背景,第二项表示进度条应该如何。

    注意:第二个项目的ID应该是android:id="@android:id/progress",如果你想要纯色可以去掉渐变。

    【讨论】:

      猜你喜欢
      • 2016-04-21
      • 2013-08-28
      • 1970-01-01
      • 2022-07-19
      • 1970-01-01
      • 2012-11-01
      • 2015-02-16
      • 2018-10-21
      • 1970-01-01
      相关资源
      最近更新 更多