【发布时间】:2015-06-30 21:06:52
【问题描述】:
问题:无法正确设置按钮样式
来源非常简单:
styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#FF00FF</item>
<item name="colorSecondary">#00FFFF</item>
<item name="colorControlNormal">#FF0000</item>
<item name="android:textColor">#0030FF</item>
<item name="android:textColorPrimary">#00FF00</item>
<item name="android:textColorSecondary">#800080</item>
</style>
布局(应用于 AppCompatActivity):
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXTVIEW"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON"
/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
清单:
<application
android:theme="@style/AppTheme" >
问题 1 是:colorControlNormal 不会影响 Button(但会影响 CheckBox)。如何为所有按钮应用任何颜色?
问题 2 是:android:textColorPrimary 属性为 Button 文本设置颜色,但 android:textColor 属性与其重叠,同时为 TextView 和 Button 文本设置颜色。我怎样才能分别设置它们?
【问题讨论】:
-
是的,事实并非如此,与片段无关。
标签: android button android-support-library android-styles