在查看了 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/