Android Studio Common Plugins

Source: Internet
Author: User

Butterknife

This open source library can let us from a large number of Findviewbyid () and Setonclicktlistener (), its impact on performance is very small (see Butter knife Source code, The implementation of its custom annotations is limited to retentionpolicy.class, that is, to compile the. CLASS file so that it works, without additional performance at run time, which is done by automatically generating Java code in Java annotations, which also has a significant disadvantage, That is, the readability of the code is somewhat poor.

1. Installing plugins
Open the Studio Setup interface, select Plugins,browse repositories ..., search Butterknife, find the Post
Select Install and restart studio after the installation is complete.

2. Project Setup

Adding a local warehouse to the build.gradle of the project

  1   dependencies {  2  classpath ' com.neenbedankt.gradle.plugins:android-apt:1.8 '  3  Classpath ' com.android.tools.build:gradle:2.2.0 '  4   5  }   6   7  allprojects {  8   repositories {  9   jcent ER ()  10   Mavencentral ()  11  12  }  13 } 

Last synchronization

3. Module settings

Add on Header

Apply plugin: ' com.android.application 'android-apt '

adding in dependent libraries

Apply plugin: ' android-apt 'com.jakewharton:butterknife-compiler:8.4.0 '
Last Sync

4. Use

In any layout, right-click the layout file (r.layout.activity_main) in your code, select Generate, and then select Butter.

Or, after you move the cursor to the layout file, press Alt+insert (Eclipse Accelerator), and then select the butter

The Open interface selects the view or onclick that requires annotations, and it can also generate Viewholder.

Android Studio Common Plugins

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.