tags:

views:

147

answers:

2

Im trying to figure out how to use Styles. It seems easy, but its not working.

First, here is my XML for the Button:

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

And here is the values/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Btest" parent="@android:style/Widget.Button">
        <item name="android:textColor">#FFFFFFFF</item>
        <item name="android:textSize">16dip</item>
        <item name="android:textStyle">bold</item>
    </style>
</resources>

Its not working at all. If I dont use Style and just add the style directly in the XML for the Button - no problem.

What am I missing?

A: 

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?

Dave Webb
Hi! Actually, it works but I cannot see it in the editor/Eclipse. I thought that Id be able to do so, but apparently not. Thats annoying, since then you dont really know how it looks until you deploy it. Makes it hard to get right - time consuming =(
Ted
A: 

The XML looks fine. Have you tried a clean build?

James