Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了循环进度条背景:Android Xamarin大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个循环的进度条,它的工作正常.但是,即使我已经给出了xml可绘制文件中的“背景”的形状,并且进度从圆的右侧开始,因此没有出现背景(如图所示) ).我想要从顶部做出来.

这是我的代码

<ProgressBar
        android:id="@+id/progressBarToday"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:layout_centerInParent="true"
        android:indeterminate="false"
        android:max="60"
        android:progress="0"
        android:progressDrawable="@drawable/progressbar" />

progressbar.xml

<?xml version="1.0" encoding="UTF-8" ?>
    <layer-list xmlns:android="http://scheR_898_11845@as.android.com/apk/res/android">
    <item android:id="@android:id/BACkground"> <---not working!
    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:thicknessRatio="7.0">
        <solid android:color="@color/red"/>
        </shape>
    </item>
    <item android:id="@android:id/progress">
    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:thicknessRatio="7.0">
        <solid android:color="@color/blue"/>
        </shape>
    </item>
    </layer-list>

我使用以下代码设置进度:

ProgressBar pb = (ProgressBar)FindViewById (resource.Id.progressBarToday);  
    _progressBar.Progress = _progressCount;

为什么背景没有出现?我如何从顶部开始进步?

任何人请帮忙,谢谢.

解决方法

您需要将以下属性添加后台项目中
android:uSELEvel="false"

像这样:

<?xml version="1.0" encoding="UTF-8" ?>
<layer-list xmlns:android="http://scheR_898_11845@as.android.com/apk/res/android">
  <item android:id="@android:id/BACkground"> <---not working!
    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:uSELEvel="false"
        android:thicknessRatio="7.0">
        <solid android:color="@color/red"/>
    </shape>
  </item>
  <item android:id="@android:id/progress">
    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:thicknessRatio="7.0">
        <solid android:color="@color/blue"/>
    </shape>
  </item>
</layer-list>

大佬总结

以上是大佬教程为你收集整理的循环进度条背景:Android Xamarin全部内容,希望文章能够帮你解决循环进度条背景:Android Xamarin所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。