How can I specify the default style of my widget

by Meryl Silverburgh » Fri, 13 Feb 2009 08:16:16 GMT


Sponsored Links
 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.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to listen on socket port 80?

Hi, guys

I'm new to Android development, now I'm working on a simple HTTP server
project. I  try to use ServerSocket to listen on port 80 but I failed. There
will have an exception if I did this. I have already set INTERNET premission
in manifest.

I found that everything is Okay if I use port 8080, that's strange for me,
why I cannot use port 80? I don't want my users to use another port to
connect  my server.

Thanks very much

Alex

-- 

2. Making broadcast receiver post of UI/main thread

Are we guaranteed that Application.onCreate() runs in the UI/main
thread? I want to assume so but I can't find any information to make
me 100 % sure.

When I receive a broadcast I want to post a message onto the UI/main
thread. Currently I've added a function in my Application class to
return a handler (created in it's onCreate), is this a good solution?
If not, what would be a better solution?

-- 

3. Phone contacts to GoogleMail?

4. ListView, SimpleCursorAdapter and Cursors

5. XPS application problem

6. Froyo_inkredroid v0.2 was WTI DefroST 0.7 for HTC Desire

7. How to adjust mic gain on HTC dev phone 2?