Coder Social home page Coder Social logo

loading's Introduction

一行代码实现加载对话框

===========

开始

在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>
  • 欢迎关注微信公众号、长期为您推荐优秀博文、开源项目、视频

loading's People

Contributors

open-android avatar

Stargazers

OftenGuy avatar  avatar  avatar  avatar oz avatar  avatar raokii avatar ccran avatar  avatar  avatar  avatar  avatar  avatar Xuejian Li avatar TIGA avatar

Watchers

James Cloos avatar York Zhang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.