eclipse代碼格式化

來源:互聯網
上載者:User

標籤:

一、設定Java代碼格式

  1、開啟Eclipse,找到Window---->Perferences---->Java---->Code Style-->Formatter

  

  2、建立Formatter,繼承內建樣式,然後點擊Edit進行修改

二、設定xml檔案格式

  1、開啟Window---->Perferences---->XML---->XML Files-->Editor

  

  2、選中Split multiple attributes each on a new line(標籤的每個屬性都單獨一行顯示)

    不選中Align final bracket in multi-line element tags(標籤結束符不單獨佔用一行)

    選中Indent using spaces(縮排使用空格代替tab)

    Indentation size  設定為4,即縮排4個空格(設定縮排寬度)

三、解決資源檔(xml檔案)格式化格式不滿意的問題

  按照上述設定xml檔案格式設定完成之後,發現布局檔案格式達到預期目標,而drawable資源檔中的xml檔案還是比較亂。

  按照如下方法設定完美解決問題。

  1、開啟Window---->Preferences---->Android---->Editors

  

  把所標註地方的勾選掉就可以了。

eclipse代碼格式化

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.