Android UI 篇- 一个漂亮的 Loading

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 (点个赞) 哦。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。