How can I specify the default style of my widge

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

How can I specify the default style of my widge

Postby silverburgh.meryl » Fri Feb 13, 2009 1:54 am

Hi,

I create my own widget with its own drawable for background.

So in my styles.xml file, I have this:
<resources>
<style name="MyWidget">
<item name="android:background">@drawable/btn_mywidget_bg</item>
</style>
</resources>

In my main.xml, if i specified my 'style' attribute, my background
drawable was displayed correctly.
<test.MyWidget android:id="@+id/mywidget" style="@style/MyWidget" />

but if I just do this:
<test.MyWidget android:id="@+id/mywidget" /> , the background drawable
is not display correctly.

Can you please tell me how can I specify the default style of my
widget so that I don't need to add style="@style/MyWidget" everytime I
use my widget?

Thank you.
silverburgh.meryl
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sun Feb 08, 2009 11:17 pm

Top

Return to General

Who is online

Users browsing this forum: No registered users and 8 guests