Flipping through git---practical progress class custom control loadingdrawable

Source: Internet
Author: User

Reprint please indicate the source: Wang 亟亟 's way of Daniel

This control before the general and see the V1 version, and then sat and did the update, and wrote the analysis of the blog, that this side of the simple to put the content of the introduction to everyone is good (and help me Easy)

First look at the effect of the operation:

The content is hand-painted, can see the original author's deep skill, 666666

This way, how to use it?

The original author wants the control to be stored under ImageView or view, so this

ImageView.setImageDrawable(new LoadingDrawable(new GearLoadingRenderer(Context))); ImageView.setImageDrawable(new LoadingDrawable(new WhorlLoadingRenderer(Context))); ImageView.setImageDrawable(new LoadingDrawable(new LevelLoadingRenderer(Context))); ImageView.setImageDrawable(new LoadingDrawable(new MaterialLoadingRenderer(Context)));

Or so

 View.setBackground(new LoadingDrawable(new GearLoadingRenderer(Context))); View.setBackground(new LoadingDrawable(new WhorlLoadingRenderer(Context))); View.setBackground(new LoadingDrawable(new LevelLoadingRenderer(Context))); View.setBackground(new LoadingDrawable(new MaterialLoadingRenderer(Context)));

Of course, if you want to manipulate the object, it is more recommended to pass in the class variable, rather than just throw it in the new one, like this

privateprivate LoadingDrawable mElectricFanDrawable;

First define a Loadingdrawable object, a ImageView object

  new LoadingDrawable(new ElectricFanLoadingRenderer(this));

Then give the image object an initialization operation (this is the first yellow control to do the demo)

 mIvElectricFan.setImageDrawable(mElectricFanDrawable);

and pass the image on to ImageView.

How do I turn the animation off?

  mElectricFanDrawable.start();//开启  mElectricFanDrawable.stop();//关闭

More nutritious analysis of the part has been posted below, want to learn the boy can see, want to directly use the above these enough

Source: Https://github.com/dinuscxj/LoadingDrawable/archive/master.zip
Analysis article: HTTP://WWW.JIANSHU.COM/P/1C3C6FC1B7FF

Flipping through git---practical progress class custom control loadingdrawable

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.