"normal" View 上的 Android 自定义属性?

标签 android xml namespaces themes

在查看了 Fede 的 UberMusic 的主题后,我发现了文件 album_screen.xml。以下是该文件的来源。基本上,我注意到他的主题能够使用作为其应用程序一部分的自定义 View ,并且它们在顶部 theme 中具有此 XML 命名空间。我错过了关于他如何将他的属性应用到他无法控制的 View ,以及 Eclipse 如何编译下面的 cod 而不会失败的联系。我将 URL http://schemas.uberdroidstudio.com/theme 放入浏览器的地址栏,但什么也没有出现,而且我不知道 Eclipse 在哪里/如何知道命名空间支持的属性。提前感谢您的帮助。

<?xml version="1.0" encoding="utf-8"?>
<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:theme="http://schemas.uberdroidstudio.com/theme">
    <TextView  
        android:id="@id/artist"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_weight="0.0"
        theme:textFilter="uppercase" /> <!-- This is the interesting line -->

最佳答案

我怀疑 theme:textFilter="uppercase" 行实际上并没有对(显然是普通的)TextView 产生影响。

至于命名空间的 URL,有趣的是您无法访问它,因为它似乎不是本地样式(Android 会让您将本地样式命名空间称为 http://schemas.android.com/apk/res/your.package)。 +1 新颖。

关于 "normal" View 上的 Android 自定义属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6811431/

相关文章:

android - Retrofit 2 解析json,从数组开始

android - 我的代码运行正确但在调试时崩溃

java - 以编程方式更改android中的字体

c++ - 使用匿名函数正确定义命名空间

javascript - 如何区分 AngularJS 中注入(inject)模块的命名空间?

xml - JAXB Marshallingremove 命名空间前缀

Android - Canvas 困惑(绘图和滚动)

javascript - 在 render() 中显示 featch json 数据时 React Native 出错

java - 使用 JAXB 从未编码的 java 对象获取 xml 元素名称

xml - 如何重命名 Oracle XMLTYPE 节点