开发者

Eclipse shortcut to convert XML attributes to style entries

开发者 https://www.devze.com 2023-02-22 22:55 出处:网络
I frequently find myself wanting to change something like this, in a layout file: android:layout_width=\"wrap_content\"

I frequently find myself wanting to change something like this, in a layout file:

  android:layout_width="wrap_content"

to the equivalent style attribute in styles.xml:

   <item name="android:layout_width">wrap_content</item>

Is there an Eclipse shortcut? Google throw开发者_开发技巧s up thousands of irrelevant results.


It looks like this is now possible with the latest tools - see http://tools.android.com/recent/extractstylerefactoring for details

Hope this helps,

Phil Lello


To clarify:

  1. You can use Eclipse build in Menu -> Refactor -> Android -> Extract Style... (Tutorial on that: http://www.jetbrains.com/idea/webhelp/refactoring-android-xml-layout-files.html)

  2. Use this simple converter: http://beadsoft.de/android/xmltostyleconverter.php

0

精彩评论

暂无评论...
验证码 换一张
取 消