我的应用程序中有一个主题,它定义了默认的文本外观和按钮样式。
<style name="AppTheme" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="android:textAppearance">@style/TextAppearance.Medium</item>
<item name="android:textAppearanceLarge">@style/TextAppearance.Large</item>
<item name="android:textAppearanceMedium">@style/TextAppearance.Small</item>
<item name="android:textAppearanceSmall">@style/TextAppearance.Medium</item>
<item name="android:textColorPrimary">#000000</item>
<item name="android:textColorSecondary">#000000</item>
<item name="android:textColorTertiary">#000000</item>
<item name="android:buttonStyle">@style/Button</item>
</style>
<style name="TextAppearance" parent="@android:style/TextAppearance">
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textColorHint">?android:attr/textColorHint</item>
</style>
<style name="TextAppearance.Large">
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">32dp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="TextAppearance.Medium">
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textSize">22dp</item>
</style>
<style name="TextAppearance.Small">
<item name="android:textColor">?android:attr/textColorTertiary</item>
<item name="android:textSize">18dp</item>
</style>
<style name="Button" parent="@android:style/Widget.Button">
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textColorHint">?android:attr/textColorHint</item>
<item name="android:textStyle">normal</item>
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
</style>
当我使用创建 RadioButton
RadioButton radioButton = new RadioButton(this, null, R.style.AppTheme);
RadioButton 已创建并且文本样式正确,但选中的标记消失了。为什么?
我在按钮组中有 Radiobutton,我在其中动态添加按钮。当我通过布局添加按钮时,标记会正确显示。但是动态添加的按钮没有。