【发布时间】:2015-12-12 21:09:30
【问题描述】:
我想创建一个橙色按钮样式,我将 style.xml 文件放置如下:
<style name="Button">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">16sp</item>
</style>
<style name="Button.OrangeButton">
<item name="android:colorBackground">@drawable/orange_button</item>
<item name="android:textColor">@color/white</item>
</style>
然后我将样式分配给一个按钮,如下所示:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Broadcast"
android:id="@+id/start_broadcast_button"
android:layout_centerInParent="true"
android:theme="@style/Button.OrangeButton"
android:layout_marginTop="20dp"
/>
但是样式指令不会传递给按钮 - 它保留默认按钮格式。
我做错了什么?
【问题讨论】:
标签: android xml android-styles