【问题标题】:Using resource values as layout attributes (config.xml)使用资源值作为布局属性 (config.xml)
【发布时间】:2010-03-28 00:59:56
【问题描述】:

查看 android sdk 文件夹,我发现了一个名为 values/config.xml 的文件。这似乎是您可以定义值以供以后在布局和动画中使用的地方。

给定 config.xml:

<resources>
    <string name="config_somePadding">50dip</string>
</resources>

我将如何引用它以用作布局 xml 文件中的 layout_height?

@string/config_somePadding 实际上是我发现的唯一一个不会在 Eclipse 中引发错误的函数(即使 values/strings.xml 中没有 config_somePadding),但它似乎只是放了一个空字符串.

在 sdk 中,他们使用整数表示动画持续时间。他们这样引用它:android:duration="@android:integer/config_longAnimTime"。有没有办法在 layout_height 属性中使用不是整数的值?

【问题讨论】:

    标签: android


    【解决方案1】:

    我将如何引用它以用作 布局 xml 中的 layout_height 文件?

    你不会的。请改用dimension resource

    有没有办法使用值 不是 layout_height 中的整数 属性?

    您必须为维度使用维度资源。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多