rya*_*dlf 13 xml android styles textcolor
我无法使用预定义的样式设置Button的文本颜色.我一定很遗憾.例如,我有一个按钮:
<Button
android:id="@+id/calculate_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/calculate"
android:background="@drawable/rounded_bottom_shape"
android:padding="5dp"
android:textAppearance="@style/CalcResultStyle">
</Button>
Run Code Online (Sandbox Code Playgroud)
相应的风格是:
<style name="CalcResultStyle">
<item name="android:textSize">12sp</item>
<item name="android:textColor">#FFF</item>
</style>
Run Code Online (Sandbox Code Playgroud)
尺寸部分工作正常,但颜色没有.我发现的唯一解决方法是在实际按钮上设置textColor,这意味着更改多个按钮上的颜色会变得很麻烦.我也喜欢使用颜色参考(例如@ color/Brown)在我的样式中设置textColor属性,但是使用引用或显式设置颜色似乎没有区别.
kal*_*a c 14
我用这个.也许它会帮助你.你能告诉我你在rounded_bottom_shape写的内容吗?
<Button
android:id="@+id/calculate_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Calculate"
android:background="#454545"
android:padding="5dp"
style="@style/CalcResultStyle">
</Button>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15041 次 |
| 最近记录: |