【问题标题】:How to list <item name="app:fabSize">[value]</item> in styles.xml?如何在styles.xml中列出<item name="app:fabSize">[value]</item>?
【发布时间】:2017-02-08 08:42:02
【问题描述】:

我尝试将 app:fabSize 包含在 styles.xml 中,但 android studio 抛出错误

有没有办法在styles.xml 中包含app:fabSize 和其他app: 属性?

Here is the code for the style tag

【问题讨论】:

  • 没有app:

标签: android android-layout android-studio floating-action-button


【解决方案1】:

在 layout.xml 中添加 Compat 属性时,应使用先前定义的命名空间(实际上不必是 app,但应通过 xmlns: 在 xml 中定义 - 例如将 hello 作为命名空间也可以。反正app是某种标准)。

<android.support.design.widget.FloatingActionButton
    xmlns:hello="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    hello:fabSize="mini"/>

但是在styles.xml 中使用Compat 属性不应该放任何东西,但是属性名称:

<style name="StyleName">
    <item name="fabSize">mini</item>
</style>

【讨论】:

    猜你喜欢
    • 2018-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-30
    相关资源
    最近更新 更多