Android循环UI进度元素

时间:2015-09-17 07:01:58

标签: android android-studio wear-os

好的。我正在尝试使用配套应用程序构建一个不错的Android Wear应用程序,我不能为我的生活找到一个没有动画的圆圈元素。要明确这是我正在寻找的。

Multistage circle graphs in Google Fit App

Single stage battrey level graph

它们看起来是相当基本的元素,但它们不在可用的默认元素的调色板中,尽管它出现在很多应用程序中并且从众多开发人员那里看到了面孔。

3 个答案:

答案 0 :(得分:3)

尝试材料进度条https://github.com/pnikosis/materialish-progress

OR

Try this link.根据需要选择其中一个进度条

答案 1 :(得分:1)

是的,这不是默认元素 基本上你有两个选择 1.去找一些合适的地方https://android-arsenal.com/tag/76。不要担心额外的依赖性,它通常由1-5个类组成,用于自定义视图 2.您可以使用Canvas.drawArc(..)方法创建自己的自定义视图。

这里有几个链接可以帮助你 https://stackoverflow.com/a/26806770/1527472
https://github.com/Todd-Davies/ProgressWheel

答案 2 :(得分:0)

您可以使用此课程。

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="270"
    android:toDegrees="270">
    <shape
        android:innerRadiusRatio="2.5"
        android:shape="ring"
        android:thickness="1dp"
        android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->

        <gradient
            android:angle="0"
            android:endColor="#007DD6"
            android:startColor="#007DD6"
            android:type="sweep"
            android:useLevel="false" />
    </shape>
</rotate>

并将其设置为android:progressDrawable =&#34; @ drawable / circular_progress_bar&#34;到你的进度条。