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:
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)
Use this simple converter: http://beadsoft.de/android/xmltostyleconverter.php
精彩评论