Improve eclipse Efficiency (ii)-Tips for improving Android development efficiency

Source: Internet
Author: User

Code hints for XML files

ADT also has code hints for XML files, in order to make the hints more violent, we have to set up

Open eclipse-window-preferences, switch to Xml-xml files-editor-content Assist in the right directory tree, is not familiar, yes, it is Content Assist

The next is simple, the delay is set to 50ms, the letter will fill in the letters can be filled up, after setting up can try. Enter the ID, the code directly prompts Android:id, the carriage return can be entered, and the cursor is positioned in double quotation marks.

Powerful Ctrl + 1

Press CTRL +1 on the code and you may get unexpected effects

For example, the following error, there is an error, no ID, and a warning, test did not write to string.xml inside

Press ctrl+1 at the error, pop up the Prompt box, select Create Resource @id/tv_test,id will be added automatically.

Similarly, press ctrl+1 at the warning, select the first item in the pop-up box, enter the name you want, and you can create an option in String.xml with "test" as the content

Color can also use this method to add

In the absence of errors, using ctrl+1 for an XML node has the following hints

Wrap in Container wraps the current node to another node, such as a textview and a layout.

Remove Container removes the parent node of the current node, such as removing the layout outside of the TextView.

The change Widget type modifies the types of the current node, targeting widgets such as TextView.

The change layout type modifies the type of the current node, with the target layout.

The Extract as include changes the current node to an include, extracting the contents of the current node into another new XML file.

Extract style Extract the attributes of the current node, with a style to replace, this is very useful, the drawback is that the property can not be completely extracted, but also save the trouble of creating a new style.

Rename does not explain, renaming, equivalent to Ctrl+shif+r

The Surround with new element encloses the current node with a fresh node.

Automatically generate code

corresponding to the function of the inherited word parent class, take activity as an example, to generate Onstart,onpause these functions, click menu Source-override/implement Methods ...

Select the corresponding function, you can choose to generate the code after that function or variable, click OK to generate the code.

It is also possible to generate set and get functions for member variables by generate Getters and setters, or to enter get or set directly, waiting for code hints.

Add source code for SUPPORT-V4

Direct introduction of Android-support-v4.jar in is not able to view the source code, but also allow location of source code, the solution is to create a new in the Libs directory

Android-support-v4.jar.properties

File, input src=c:\\android\\sdk\\extras\\android\\support\\v4\\src

C:\\android\\sdk\\extras\\android\\support\\v4\\src for the source folder, if you want to carry the source code, you can put into the package into the project directory,

Jar CVF Android-support-v4-src.jar -c src .

Android-support-v4-src.jar for the registration to be generated, SRC is the source directory

After packaging is complete, copy the Android-support-v4-src.jar to the Libs directory, and the contents of the Android-support-v4.jar.properties file are modified to

Src=./android-support-v4-src.jar,

Restart Eclipse to see the source code.

Other

The students who have been using F3 may also be tragically not found, in the code can be directly located in the XML. In the code to use the resource ID F3, will be positioned to R.java, basically no use, but use CTRL + left mouse button click, will go directly into the XML file, it is too convenient. If an ID is used in multiple XML files, hold down CTRL and the mouse moves to the ID position, a list pops up, and clicking the list jumps to the corresponding XML

You can preview the display of different resolutions at the same time in eclipse, which is useful for adapting

There are several useful buttons in the Eclipse toolbar

New package, new class, new Android XML file, code scan (you can sweep out which of the defined strings in String.xml are not used and so on, the function is not familiar),

These shortcut buttons are much more convenient than using the right button.

Reference: http://www.cnblogs.com/sw926/p/3300747.html

Improve eclipse Efficiency (ii)-Tips for improving Android development efficiency

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.