android - 为什么android中xml的style属性没有命名空间

标签 android xml android-layout

<分区>

我们知道 xml 布局文件中的每个属性都有一个命名空间。例如:

    <TextView
        style="@style/xxx"
        android:id="@+id/title_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/my_photos" 
    />

id布局layout_width layout_height文本属性都有一个命名空间“android” 为什么 'style' 属性没有?

最佳答案

在 Android 的 xml 文件中,为了使用“android:”命名空间,您必须在开头的某处放入一行:

xmlns:android="http://schemas.android.com/apk/res/android"

“风格”不是从那里来的。

还有更多(重复):Reason why style attribute does not use the android: namespace prefix

关于android - 为什么android中xml的style属性没有命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36658924/

相关文章:

android - 如何找到最新的 gradle 版本和包装器

Android 页面控件像书本一样?

xml - 似乎无法从 xml 加载 webview,为什么?

java - 在 Draggable GridView 中显示布局

android - 有没有办法显示 Android Activity 堆栈?

android - 测试框架意外退出 - ClassNotFound 异常

java - Android 中按钮设置为 Null 并生成 NullPointerException

python - Xml - 使用 Python 按标记查找元素

android - 水平 RecylerView 多行显示不正确

Android 相对布局无法使图像居中