Eclipse Code Formatting

Source: Internet
Author: User

First, set the Java code format

1. Open Eclipse and Find window---->perferences---->java---->code style-->formatter

  

2. Create a new formatter, inherit the built-in style, then click Edit to Modify

Second, set the XML file format

1. open window---->perferences---->xml---->xml files-->editor

  

2. Select Split multiple attributes each on a new lines (each property of the tag is displayed on a separate line)

Uncheck Align final bracket in multi-line element tags (tag terminator does not occupy a single line)

Check Indent using spaces (indent using spaces instead of tab)

Indentation size is set to 4, that is, 4 spaces are indented (set indent width)

Third, resolve the problem that the format format of the resource file (XML file) is not satisfactory

After setting the XML file format settings as described above, it is found that the layout file format achieves the desired goal, while the XML file in the Drawable resource file is still quite chaotic.

Set the perfect solution to the problem as follows.

1. open window---->preferences---->android---->editors

  

Check out the places you've marked.

Eclipse Code Formatting

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.