gpt4 book ai didi

android - 带有圆形指示器android的水平进度条

转载 作者:行者123 更新时间:2023-11-29 01:17:55 25 4
gpt4 key购买 nike

我想在进度值的末尾显示圆圈(点)指示符。是这样的:-

horizontal progressbar indicator image

这是我的进度条 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">
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="270"
android:centerColor="#EBEBEB"
android:centerY="0.75"
android:endColor="#EBEBEB"
android:startColor="#EBEBEB" />
</shape>
</item>

<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="270"
android:centerColor="#EBEBEB"
android:centerY="0.75"
android:endColor="#EBEBEB"
android:startColor="#EBEBEB" />
</shape>
</clip>
</item>

<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="270"
android:centerColor="#00FFB7"
android:centerY="0.75"
android:endColor="#00FFB7"
android:startColor="#00FFB7" />
</shape>
</clip>
</item>
</layer-list>

目前看起来像这样:-

current progressbar

请帮我添加圆形指标。谢谢

最佳答案

添加 Gradle 依赖:

dependencies {
compile 'com.github.rey5137:material:1.2.4'
}

在xml代码中使用这种方式

 <com.rey.material.widget.Slider
android:id="@+id/slider_sl_continuous_disable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="16dp"
android:enabled="false"
app:v_styleId="@array/slider"/>

您可以在themes.xml 文件中定义silder

 <array name="slider">
<item>@style/LightSlider</item>
</array>

styles.xml文件中这样定义

 <style name="LightSlider" parent="Material.Widget.Slider">
<item name="sl_primaryColor">@color/colorPrimary</item>
</style>

输出:

enter image description here

希望对您有所帮助。快乐编码..

关于android - 带有圆形指示器android的水平进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38496083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com