Giter Site home page Giter Site logo

easyloading's Introduction

EasyLoading

Showing LoadingView or EmptyView easily for Activity and Fragment in Android.

How to use

Activity

#####1.Show LoadingView in an Activity

ActivityTool.showLoading(Activity activity, int layoutId)
ActivityTool.showLoading(Activity activity, View view)
ActivityTool.showLoading(Activity activity, int layoutId, boolean dimBackground)
ActivityTool.showLoading(Activity activity, View view, boolean dimBackground)

#####2.Show EmptyView in an Activity

ActivityTool.showEmpty(Activity activity, int layoutId)
ActivityTool.showEmpty(Activity activity, View view)

#####3.dismiss LoadingView / EmptyView from Activity

ActivityTool.dismiss(Activity activity)

Fragment

#####1.Show LoadingView in Fragment

FragmentV4Tool.showLoading(Fragment fragment, int layoutId)
FragmentV4Tool.showLoading(Fragment fragment, View view)
FragmentV4Tool.showLoading(Fragment fragment, int layoutId, boolean dimBackground)
FragmentV4Tool.showLoading(Fragment fragment, View view, boolean dimBackground)

#####2.Show EmptyView in Fragment

FragmentV4Tool.showEmpty(Fragment fragment, int layoutId)
FragmentV4Tool.showEmpty(Fragment fragment, View view)

#####3.dismiss LoadingView / EmptyView from Fragment

FragmentV4Tool.dismiss(Fragment fragment)

####Notice To showing LoadingView or EmptyView in a Fragment, the Fragment’s rootView must be a FrameLayout or FrameLayout’s subclass, you can define a xml-layout which rootView is FrameLayout for the Fragment or just make your Fragment extends LoadingSupportFragment / LoadingFragment and achieve the method contentViewLayoutId() to return your xml-layoutId, and you don’t need to override the method onCreateView(); yeah, you can show the EmptyView or LoadingView simply;

为了让Fragment能够显示LoadingView或EmptyView,Fragment所创建的view必须是FrameLayout或者FrameLayout的子类,这里有两种快捷的方法,一是同往常一样,定义一个layout布局文件然后让Fragment创建view,但该layout的rootView必须为FrameLayout;二是继承LoadingFragment或者LoadingSupportFragment,并且实现方法contentViewLayoutId(),在该方法中返回自定义的layout布局文件,该布局文件则没有rootView的限制,rootView可以是任意的控件,并且,使用这种方法也就不需要再重写Fragment的onCreateView方法;

###截图 http://img.my.csdn.net/uploads/201509/24/1443103079_9956.jpg http://img.my.csdn.net/uploads/201509/24/1443103078_1740.jpg http://img.my.csdn.net/uploads/201509/24/1443103078_5010.jpg http://img.my.csdn.net/uploads/201509/24/1443103077_4555.jpg

easyloading's People

Contributors

a284628487 avatar

Watchers

 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.