美文网首页
Android UI 篇- 一个漂亮的 Loading

Android UI 篇- 一个漂亮的 Loading

作者: trycatchx | 来源:发表于2020-06-07 11:13 被阅读0次

MutlColorLoadingView

分享一个漂亮的多颜色 LoadingView (有点像设置谷歌账号的Loading进度条)目前不做代码分析,如果后面有读者强烈要求的话后面再补上。

效果展示

demo.gif

如何使用:

  • 加入 gradle 依赖
implementation 'com.mutlcolorloadingview:mutlcolorloadingview:1.0.0'
  • 在 xml 加入相应的动画::
<com.mutlcolorloadingview.MutlColorLoadingView
        android:id="@+id/mclv"
        android:layout_width="120dp"
        android:layout_height="105dp"
        android:padding="28dp"
        android:background="@drawable/bg_loading"
        app:mclv_duration="2000"
        app:mclv_first_color="@color/color_FFFFFFFF"
        app:mclv_second_color="@color/color_FF4D6BFF"
        app:mclv_three_color="@color/color_FFFF8400"
        app:mclv_stroke_width="4dp"
        />

可使用的参数解析

LightProgressView 自定义参数:

    <declare-styleable name="MutlColorLoadingView">
        <!--The color of the first progress-->
        <attr name="mclv_first_color" format="color" />
        <!--The color of the second progress-->
        <attr name="mclv_second_color" format="color" />
        <!--The color of the three progress-->
        <attr name="mclv_three_color" format="color" />
        <!--A round of time-->
        <attr name="mclv_duration" format="integer" />
        <!--Angle of progress-->
        <attr name="mclv_start_angle" format="integer" />
        <!--The thickness of the progress bar-->
        <attr name="mclv_stroke_width" format="integer|dimension"/>
        <!--The ratio of the first color progress to the total progress-->
        <attr name="mclv_rate_first_round" format="float" />
    </declare-styleable>

下面给出这个动画的开源代码。github传送门。记得给个 Star (点个赞) 哦。

相关文章

网友评论

      本文标题:Android UI 篇- 一个漂亮的 Loading

      本文链接:https://www.haomeiwen.com/subject/tfdbzhtx.html