开发者

Eclipse shortcut to convert XML attributes to style entries

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜