Use of Butter knife (Android Studio only)

Source: Internet
Author: User

April, May is much busier than before, understand a lot, also changed a lot, today is still forced to work overtime, the job at hand is almost done, think it has been a long time without learning new knowledge. Lazy and stupid, but also do not want to live up to the kindness of friends, Butter Knife is a friend introduced the more useful class library. Today with a bit or very useful although and xutils notes very acquaintance, but if the project network request does not use Xutils, you can use it, want to say its use method is really simple, all understand it.

Configuration:

when configured with Gradle, add:

Compile ' com.jakewharton:butterknife:6.1.0 '

Note is added in the module: app 's Gradle file.

Plus you don't have to run any commands, just sync it and see Butterknife in external libraries.

Function:

1. Reduce Findviewbyid ()


can also be used in 2.fragment


The 3.iewHolder class adds a construction method with a parameter view, marking each field with annotations, and no longer having to call the Findviewbyid () method in the GetView () method.


4. Reduce Setonclicklistener ()



Of course, there are many more useful methods, I picked a few often used to study a bit, we are interested in learning other, such as the Reset () method can be used to inject Butterknife view reference set to null and so on. Everyone has a good weekend.

Use of Butter knife (Android Studio only)

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.