You may not know the "multi-line edit" of Android Studio Tips

Source: Internet
Author: User

Android Studio Everyone should be familiar with, but probably a lot of people are limited to basic function use, and Android Studio is very powerful, there are many very practical but little-known tips, mastering these tips will greatly improve your productivity, Today, I would like to introduce you to a very useful little trick, "multi-line editing."

Under normal circumstances, we write code is a line of knocking, as we did when we were a child of the writing industry is a pen to write, and some students in the writing of some duplication of homework at the same time with two pens written, such as I have done this kind of thing. When it comes to repetitive work, it's a great productivity boost, and Android Studio has a feature like "multi-line editing."

Shortcut keys:

Mac:ctrl + G

Windows/linux:alt + J

What is the specific usage scenario? Suppose we have a large section of code similar to r.id.xx code, and so on after the sudden discovery, crouching groove, the original is r.string.xx, this time if a change does not bother to die, with multiple lines of editing, we just need to check r.id and then press Ctrl + G will select these same code, Then multiple actions are selected, such as:

With SHIFT +, or SHIFT + <-

and SHIFT + CMD +--or SHIFT + CMD + <-

Plus SHIFT + ALT + or SHIFT + ALT + <-

Three ways to select the multiple lines of text you want to edit or delete, as to what the differences are in these three ways, it's clear to try it out yourself.

Isn't it very convenient?

To give a more common use, we should be a lot of people using butterknife, we know that Butterknife is very convenient to use, but it is written to bind the ID of each control, and then need to be in the OnClick event according to the different ID to deal with, This is a bit of repetitive labor (of course, there is now a butterknife as plug-in is very convenient to automatically generate code, it is only convenient to do a sample demonstration only), and if you know the Ctrl + G function can be done as follows:

Isn't it very simple and fast? Of course, multi-line editing has other more convenient uses, such as refactoring the code and so on, which you need to use according to your needs.

Multi-line editing function although the actual development is not used very often, but you have to know that there is this feature, once you want to use the time you will be very lucky to have such a cool feature has been there, it is afraid you do not know!

This article was originally published in the public number Androiddeveloper, reproduced please be sure to indicate the source.

You may not know the "multi-line edit" of Android Studio Tips

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.