Build your development artifacts-introduce several plug-ins on Android Studio

Source: Internet
Author: User

Build your development artifacts-introduce several plug-ins on Android Studio



1. Android Parcelable code generator

As the name suggests, this is a plug-in that generates code that implements the Parcelable interface.

In your class, press alt + insert to bring up the context menu for inserting code. You will see a Parcelable below, as shown below. After you select it, the Code Implementing the Parcelable interface will be inserted in your class. No need to manually write the Parcelable code. How does it feel?


2. AndroidCodeGenerator

It introduces the code that can generate the ViewHolder and findView methods. However, I have not found the code for generating the findView method, but ViewHolder is also cool.

In the getView of your Adapter implementation class, place the cursor in the variable of the ID of your layout file, and press Alt + Insert plug-in code. You can see that there is another Create view holder, for example.

After you select it, it will generate the corresponding ViewHolder code for you based on the element with id declared in the layout file, as shown below:


        public class ViewHolder {            public final TextView time;            public final ImageView isnew;            public final TextView username;            public final TextView department;            public final ImageView enter;            public final CircleImageView avatar;            public final RelativeLayout listcontent;            public final View root;            public ViewHolder(View root) {                time = (TextView) root.findViewById(;                isnew = (ImageView) root.findViewById(;                username = (TextView) root.findViewById(;                department = (TextView) root.findViewById(;                enter = (ImageView) root.findViewById(;                avatar = (CircleImageView) root.findViewById(;                listcontent = (RelativeLayout) root.findViewById(;                this.root = root;            }        }

Is it convenient?



3. Android Layout ID Converter

As I did not find a way to generate findView code in the plug-in above, I found another plug-in to generate such code.

Usage: Right-click your layout file and select Convert Android layout xml from the pop-up menu, as shown in:

Then a panel is displayed, as shown below. Select the format of the Code to be generated and press OK. Then, it copies the generated code to your clipboard. Then, you are using the Activity or Fragment of the layout file, press Ctrl + V to paste the code.


4. SelectorChapek for Android

This is the plug-in used to generate Selector. Right-click the drawable folder and select Generate Android Selectors from the pop-up menu. As shown in the following figure, it will name the resources in several drawable folders, help you generate Selector code. Of course, your resource file needs to be named according to the agreed suffix. For example, the press status is _ pressed, the normal status is _ normal, and the unavailable status is _ disable. For more details, see the description file of this project on Github. The project address is


5. Sexy Editor

This is the finale plug-in this article. Let's take a look at the effect:

I feel that the code is suddenly full of passion! Not much about the usage method. Read the official instructions or find your own solution. I believe that, inspired by this image, you will soon learn how to use it.

Note: This plug-in has a side effect, that is, it will become stuck after a long time, or even die. My desktop, 8 GB memory (only 300 or 400 mb in the permanent zone), will become more and more cards when switching to open files frequently, it may become OOM in half a day. When this plug-in is not used, no ide oom has been encountered. So weigh it yourself.


Related Article

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: 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.