开发者

Style does not work on Button

开发者 https://www.devze.com 2022-12-15 11:49 出处:网络
Here is my XML for a Button: <Button style=\"@style/Btest\" android:id=\"@+id/Button01\" android:layout_width=\"wrap_content\"

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

精彩评论

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