4

我的布局中有一些单选按钮和/或复选框,我希望TextViews它们周围的文本外观(大小、颜色等)相同。

基本上,我正在寻找类似以下的内容:

<TextView
    android:textAppearance="?android:attr/textAppearanceRadioButton"
    ...
/>

是否有可能以其他方式实现这一目标?

PS:我不想更改单选按钮和复选框已有的“默认”文本外观。另外,我不是在寻找运行时解决方案,而是在寻找利用 xml 布局文件的解决方案。

4

2 回答 2

2

我现在找到了,这似乎至少适用于Theme.Holoand Theme.Holo.Light

android:textAppearance="?android:attr/textAppearance"
android:textColor="?android:attr/textColorPrimaryDisableOnly"

这些是设置在 aCheckBox上但未设置在 a上的两件事TextView

于 2013-09-17T12:05:36.237 回答
-1

根据Android API docs(强调我的):

安卓:文本外观

基本文本颜色、字体、大小和样式。

必须是对另一个资源的引用,形式为“@[+][package:]type:name”或主题属性的形式为“?[package:][type:]name”。

这对应于全局属性资源符号 textAppearance。

这表明您只需要在 s 的 android:textAppearance属性中引用您TextView在 s 中使用的相同资源RadioButton

于 2012-11-18T01:23:17.150 回答