Skip to content

open-android/Loading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

一行代码实现加载对话框

===========

开始

在project的build.gradle添加如下代码(如下图)

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

在build.gradle添加依赖

     compile 'com.github.open-android:Loading:1.0'

For example:

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

===========

For example:

默认是白色,想修改样式直接修改style,代码如下:

<?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();

Result:

如果想改变加载的文字,代码如下,默认是loading,英文的,想改成中文,代码如下:

new SpotsDialog(context, "Завантаження").show();

Note: 设置颜色代码如下.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="spots_dialog_color">@color/your_color_value</color>
</resources>
  • 欢迎关注微信公众号、长期为您推荐优秀博文、开源项目、视频

About

一行代码实现加载对话框

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages