开发者

Style does not work on Button

Here is my XML for a Button:

<Button
  style="@style/Btest"
  android:id="@+id/Button01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="Some text"
  />

And here is the style XML for the Button:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Btest" parent="@android:style/Widget.Button">
        <item name="andr开发者_高级运维oid:textColor">#FFFFFFFF</item>
        <item name="android:textSize">16dip</item>
        <item name="android:textStyle">bold</item>
    </style>
</resources>

But, the style XML has no effect on the Button. If I skip the style XML and apply the style directly in the Button XML, things work as intended.

What am I missing?


Are you using the parent="@android:style/Widget.Button" for a particular reason? You only need to specify a parent when you want to inherit from another style. What happens if you remove this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜