Setting theme in an activity

by Sudeep Jha » Sun, 06 Jun 2010 14:47:45 GMT


Sponsored Links
 Hi All,

This is my  themes.xml file

<resources>

<style name=*"Theme.Blue"* parent=*"android:Theme"*>

<item name=*"android:windowBackground"*>*...@drawable*/bodyimg_blue</item>

<item name=*"android:colorBackground"*>@color/*royalblue*</item>

<item name=*"android:textColor"*>@color/*midnightblue*</item>

<item name=*"android:textViewStyle"*>@style/TextViewBlue</item>

</style>
<resources>
This is main activity code snippet

*public* *void* onCreate(Bundle savedInstanceState) {

*super*.onCreate(savedInstanceState);

setTheme(R.style.Theme_Blue);

setContentView(R.layout.*main_screen*);
...
The background image is not getting loaded but the text color and
textViewStyle got changed.
The background image remains the defalult one -blank screen.
If I am setting the theme in android manifest file then it works properly.
Can anybody tell me the reason for this?

Warm Regards,
Sudeep

--



Setting theme in an activity

by Sudeep Jha » Sun, 06 Jun 2010 16:55:47 GMT


 Hi All,

This is my  themes.xml file

<
resources>

<style name=*"Theme.Blue"* parent=*"android:Theme"*>

<item name=*"android:windowBackground"*>*...@drawable*/bodyimg_blue</item>

<item name=*"android:colorBackground"*>@color/*royalblue*</item>

<item name=*"android:textColor"*>@color/*midnightblue*</item>

<item name=*"android:textViewStyle"*>@style/TextViewBlue</item>

</style>
<resources>
This is main activity code snippet

*public* *void* onCreate(Bundle savedInstanceState) {

*super*.onCreate(savedInstanceState);

setTheme(R.style.Theme_Blue);

setContentView(R.layout.
*main_screen*);
...
The background image is not getting loaded but the text color and
textViewStyle got changed.
The background image remains the defalult one -blank screen.
If I am setting the theme in android manifest file then it works properly.
Can anybody tell me the reason for this?

Warm Regards,
Sudeep



-- 
Warm Regards,
Sudeep

--


Sponsored Links


Setting theme in an activity

by Bob Kerns » Mon, 07 Jun 2010 09:59:45 GMT


 Try moving the setTheme(R.style.Theme_Blue) call to before the
super.onCreate(savedInstanceState) call.





--



Other Threads

1. XML editor problem

Hi

  I am trying to create an xml file under "res/xml" folder.

  When an xml file is newly created in the "res/layout" folder, the
xml editor comes up with a neat GUI giving me options to choose
layout, view, etc.

  However, when I create an xml file under "res/xml" folder, no such
options are shown. I would like to create an xml for PREFERENCE (radio
button).

  Please let me know if I am going wrong somewhere?

Thanks.

-- 

2. Using Instrumentation for functional testing

I need to create functional tests in a context outside of a junit test
method.  I do have the ability to create a class that inherits from
one of the TestCase derived classes in android but I cannot create a
test method.  I was hoping to start the instrumentation and then call
methods to simulate user interaction.  I have been unable to find
examples that demonstrate this capability.  Does anybody have
experience with this?

Thanks

-- 

3. From one Tab change to another one

4. AppRank?

5. Free Heap to Small to Allocate Bitmap

6. Detect and pick up Gesture in a filled ListActivity

7. About to release first app to market.