spots-dialog:移動加載提示的自定義Android AlertDialog

jopen 9年前發布 | 43K 次閱讀 Android開發 移動開發 spots-dialog

Android AlertDialog實現顯示圓點水平移動加載提示
運行效果:

使用說明:

和AlertDialog的使用方法一樣:

AlertDialog dialog = new SpotsDialog(context);
dialog.show();
...
dialog.dismiss();

Use android styles to customize the dialog. Next custom attributes provided:

使用樣式來自定義dialog:

  • DialogTitleAppearance : style reference

  • DialogTitleText : string

  • DialogSpotColor : color

  • DialogSpotCount : integer

比如:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Custom" parent="android:Theme.DeviceDefault.Dialog">
        <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
        <item name="DialogTitleText">Updating…</item>
        <item name="DialogSpotColor">@android:color/holo_orange_dark</item>
        <item name="DialogSpotCount">4</item>
    </style>
</resources>

應用此樣式

new SpotsDialog(context, R.style.Custom).show();

結果:

在5.0之前的設備上DialogSpotColor無效果,因為沒有@android:color/holo_orange_dark顏色,可以在你的資源文件中自己定義一個

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="spots_dialog_color">@color/your_color_value</color>
</resources>

項目主頁:http://www.baiduhome.net/lib/view/home/1434528013192

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!