Material Demo (1) CircularProgress, Button

Custom CircularProgressDrawable

預(yù)覽
預(yù)覽

styles.xml 自定義 style

    <style name="rainbow" parent="Material.Drawable.CircularProgress">
        <item name="cpd_strokeColors">@array/progress_colors_light</item>
    </style>

colors.xml 自定義 color array

<array name="progress_colors_light">
    <item>#FF03A9F4</item>
    <item>#FFD8433C</item>
    <item>#FFF2AF3A</item>
    <item>#FF279B5E</item>
</array>

布局文件

        <com.rey.material.widget.ProgressView
            android:layout_width="48dp"
            android:layout_height="48dp"
            app:pv_autostart="true"
            app:pv_circular="true"
            app:pv_progressStyle="@style/rainbow"
            app:cpd_strokeColors="@array/progress_colors_light"
            app:pv_progressMode="indeterminate"/>

Custom Button

Ripple 效果
Ripple 效果

colors.xml 添加

    <color name="selected">#2338a9</color>
    <color name="unselected">#4d68ff</color>

drawable文件夾創(chuàng)建 XML 添加

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/selected" android:state_pressed="true" />
    <item android:drawable="@color/unselected" />
</selector>

Button 布局文件

    <com.rey.material.widget.Button
        style="@style/Material.Drawable.Ripple.Wave.Light"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#fff"
        android:text="Ripple.Wave.Light"
        android:background="@drawable/my_button"
        app:rd_rippleColor="@color/selected"
        app:rd_enable="true"/>

大神插件地址

https://github.com/rey5137/material

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容