【问题标题】:Eclipse shortcut to convert XML attributes to style entries将 XML 属性转换为样式条目的 Eclipse 快捷方式
【发布时间】:2011-08-01 20:41:58
【问题描述】:

我经常发现自己想在布局文件中更改如下内容:

  android:layout_width="wrap_content"

styles.xml中的等效样式属性:

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

有 Eclipse 快捷方式吗? Google 会抛出数千个不相关的结果。

【问题讨论】:

  • 您可以通过 XSL 转换来做到这一点。不过我没有现成的示例,可能需要一段时间才能正确。

标签: android xml eclipse layout shortcut


【解决方案1】:

现在使用最新工具似乎可以实现这一点 - 详情请参阅 http://tools.android.com/recent/extractstylerefactoring

希望这会有所帮助,

菲尔·莱洛

【讨论】:

  • 看起来就是这样。知道什么时候发布吗?
  • 不知道 - 我在浏览网站时发现了这一点。我相信最新的源代码可以在android.git.kernel.org/?p=platform/sdk.git;a=summary 获得,但是我从未尝试编译源代码 - 我只是将它们用作参考。
  • 我觉得现在应该已经发布了,但我不知道从哪里得到它。有人知道怎么做吗?
  • 没关系,你得去eclipse菜单栏中的Refactor菜单。
【解决方案2】:

澄清一下:

  1. 您可以在 Menu -> Refactor -> Android -> Extract Style 中使用 Eclipse 构建...(教程:http://www.jetbrains.com/idea/webhelp/refactoring-android-xml-layout-files.html

  2. 使用这个简单的转换器:http://beadsoft.de/android/xmltostyleconverter.php

【讨论】:

猜你喜欢
  • 2015-04-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-25
  • 2014-06-04
  • 2021-04-19
  • 1970-01-01
  • 2019-03-30
相关资源
最近更新 更多