Applying a Theme to your Application

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Postby nisha » Thu Apr 24, 2008 7:02 am

Hi,


Thanks a lot... :D

Regards,
nisha
nisha
Experienced Developer
Experienced Developer
 
Posts: 80
Joined: Fri Feb 15, 2008 7:52 am

Top

Postby ebersmoll » Mon Jun 09, 2008 8:52 am

validateText1 = new Button(this);
validateText1.setId(3);
validateText1.setText(" Text Msg ");
validateText1.?????????(this, android.R.style.Widget_Button_Small);
validateText1.setOnClickListener(this);


is there such a funtion that can aid me to use this kind of style
i believe there must sure be something or else what is the point of providing a android.R.style.Widget_Button_Small
Windmill windmill on the land
love forever love is free
ebersmoll
Freshman
Freshman
 
Posts: 7
Joined: Fri Apr 04, 2008 4:41 am
Location: Delhi

Theme

Postby nisha » Mon Jun 09, 2008 9:53 am

Hi ,


U can set like...

setTheme(android.R.style.Theme_Light);

regards,
nisha
nisha
Experienced Developer
Experienced Developer
 
Posts: 80
Joined: Fri Feb 15, 2008 7:52 am

system theme

Postby zanky » Tue Aug 19, 2008 2:23 pm

Not to revive an old thread, but I have a quick question that I don't think was really covered here.


How to create/set a theme for the entire phone. Meaning, changing the entire look of the home screen, the menus, the applications menu... Not just different color, but different UI as well.

I've looked on Google's sites, but can't seem to find much. It all seems to talk about themes on the application level, not system.

Ideas?

Z
zanky
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu Jul 10, 2008 4:45 pm

Re: system theme

Postby plusminus » Tue Aug 19, 2008 3:32 pm

zanky wrote:Not to revive an old thread, but I have a quick question that I don't think was really covered here.


How to create/set a theme for the entire phone. Meaning, changing the entire look of the home screen, the menus, the applications menu... Not just different color, but different UI as well.

I've looked on Google's sites, but can't seem to find much. It all seems to talk about themes on the application level, not system.

Ideas?

Z


I haven't seen a possiblity to replace the Theme used by other applications. (Not checked the new SDK)
But you can rewrite all apps (lol) and make them use your desired theme.

Anyway I think/hope there will be a possibility to change the overall themes and a possibility to add custom ones. (Maybe not in Android 1.0 and maybe only for phone makers)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

hmm

Postby zanky » Tue Aug 19, 2008 4:11 pm

I seem to recall reading a looong time ago something about being able to override the home screen with your own copy (...). Something like that. Can't find it now, but I thought that Google had emphasized the customability of Android, especially in the UI.

I guess I could try to hack into the filesystem to find something... but would rather not....

I was hoping that such functionality would come before 1.0 :-/
zanky
Junior Developer
Junior Developer
 
Posts: 11
Joined: Thu Jul 10, 2008 4:45 pm

Top

Postby dhaiwat » Fri Sep 18, 2009 10:49 am

theme in android
Attachments
themedemo.zip
how to apply the theme in android
(212.1 KiB) Downloaded 278 times
dhaiwat
Developer
Developer
 
Posts: 28
Joined: Tue Feb 10, 2009 6:49 am

Postby SeraphimSerapis » Wed Nov 04, 2009 12:48 pm

I know this is an old topic, but I do have a problem regarding applying themes.
I let the user pick a theme in my application and apply it the way presented by plusminus.
When I set the Black Theme everything works great, but when I apply the Light Theme only the font colour changes.

ImageImage

The left screenshot is the Light Theme, the right one the Black Theme.

Regards,
Tim
SeraphimSerapis
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed Mar 11, 2009 10:57 pm

Re: Applying a Theme to your Application

Postby catalin » Mon Jun 07, 2010 10:58 am

hi all.
Thanks for info, great post!

I want to add themes to my android application. In the application, user will have the options to changes theme of the application. Please help how do i implement this kind of structure to my application.

Any help, tutorials, guidance are highly appreciated.

thanks..
catalin
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Jun 07, 2010 10:53 am

Re: Applying a Theme to your Application

Postby padmajadav » Fri Jun 25, 2010 5:44 am

Is it possible to change application background colour only at runtime ?
- _Parry
padmajadav
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Mar 25, 2010 7:39 am
Location: Ahmedabad

Re: Applying a Theme to your Application

Postby ace » Tue Nov 23, 2010 6:25 am

Is it possible to integrate the current theme of the android device in an application? How can i apply the present device theme in my app?

I would like to show my app based on the present theme of device (like using the same device wallpaper in the backdrop of my application which is presently used in the home screen of the phone).
ace
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Nov 23, 2010 6:11 am

Re:

Postby marcboy » Thu Jan 20, 2011 6:50 pm

SeraphimSerapis wrote:I know this is an old topic, but I do have a problem regarding applying themes.
I let the user pick a theme in my application and apply it the way presented by plusminus.
When I set the Black Theme everything works great, but when I apply the Light Theme only the font colour changes.

ImageImage

The left screenshot is the Light Theme, the right one the Black Theme.

Regards,
Tim

This can be solved by placing the setTheme() before super.onCreate(); :)
marcboy
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Jan 20, 2011 6:49 pm

Re: Applying a Theme to your Application

Postby abeljus » Tue Feb 01, 2011 2:29 pm

Hi,

I'm trying to set a theme to MyActivity in the beginning of OnCreate() method as you posted, but I have a problem.

If I set a predefined theme (like android.R.style.Theme_Light), it works, but if I try to set a custom theme (e.g. R.style.My_Theme_Activity), it does not work.

I think my theme is correct because if I set it to the activity in the AndroidManifest file, it works perfectly.

My theme looks like:
Code: Select all
<style name="My_Theme_Activity" parent="@android:style/Theme">
   <item name="android:windowBackground">@android:color/transparent</item>
   <item name="android:windowIsTranslucent">true</item>
</style>


And my activity OnCreate():
Code: Select all
protected void onCreate(Bundle savedInstanceState) {
      //setTheme(R.style.My_Theme_Activity); // <-- This doesn't work
      setTheme(android.R.style.Theme_Light); // <-- This works
      super.onCreate(savedInstanceState);
   }




What am I missing?

Thank you very much!
abeljus
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Feb 01, 2011 2:12 pm

Re: Applying a Theme to your Application

Postby jdrefahl » Wed Mar 02, 2011 7:23 pm

Seriously thank you for this little primer on Themes.. I have always felt that Themes were a pretty powerful yet very undocumented part of the whole SDK.. Well, I see Google has documented them, but not in any way a normal human being could ever make use off.. I figure this would also help those who run into the "my entire listview turns black when I tap it." problem people run into.

None the less, thanks.. and anything more you find out.. pass it on..
john
John Drefahl
Massive Media / Soundclash Media
"Changing the world, one app at a time"
http://www.twitter.com/johnsin
User avatar
jdrefahl
Junior Developer
Junior Developer
 
Posts: 15
Joined: Wed Mar 02, 2011 6:06 pm
Location: San Francisco

Re: Applying a Theme to your Application

Postby hardikn88 » Mon Jul 11, 2011 10:35 pm

Hello Plusminus.

Do you know if it's possible to change the theme of an activity more than once ?
I know that the theme can be set by code, but as far as I know it must be done before the call to setContentView, so is it possible to change the theme after calling setContentView, for example, when the user presses a button.

Thank you
hardikn88
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Jul 11, 2011 10:32 pm

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests