Tutorial: UI Themes

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

Tutorial: UI Themes

Postby darolla » Tue Jan 13, 2009 9:33 am

Hi,

Did you know that there are some ui themes inside Android?

They are pretty easy to use, although they don't look very nice.

All you have to do is add one attribute in the manifest:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:theme="@android:style/Theme.Black"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:theme="@android:style/Theme.Light"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:theme="@android:style/Theme.Translucent"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Your manifest will look like this:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.         package="org.theme" android:versionCode="1" android:versionName="1.0.0">
  7.  
  8.  
  9.  
  10.         <application android:icon="@drawable/icon" android:label="@string/app_name">
  11.  
  12.  
  13.  
  14.                 <activity android:name=".Test" android:label="@string/app_name"
  15.  
  16.                         android:theme="@android:style/Theme.Light">
  17.  
  18.  
  19.  
  20.                         <intent-filter>
  21.  
  22.                                 <action android:name="android.intent.action.MAIN" />
  23.  
  24.                                 <category android:name="android.intent.category.LAUNCHER" />
  25.  
  26.                         </intent-filter>
  27.  
  28.  
  29.  
  30.                 </activity>
  31.  
  32.  
  33.  
  34.         </application>
  35.  
  36. </manifest>
  37.  
  38.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


I will attach four screenshots using the three different themes and one without a theme. They are based on the
making own theme layout from pskink.

Greetings,
DaRolla
Attachments
Theme.Black.png
Theme.Black.png (13.13 KiB) Viewed 50185 times
Theme.Light.png
Theme.Light.png (14.02 KiB) Viewed 50185 times
Theme.Translucent.png
Theme.Translucent.png (61.24 KiB) Viewed 50185 times
without theme.png
without theme.png (13.77 KiB) Viewed 50185 times
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Postby The Spirit » Tue Jan 13, 2009 9:36 am

is "without theme" the same as the "black theme"?
The Spirit
Developer
Developer
 
Posts: 48
Joined: Fri Jan 02, 2009 1:59 pm
Location: Germany

Postby darolla » Tue Jan 13, 2009 9:38 am

hi,

it seems that android is using black theme in case nothing else is specified :D

greetings,
darolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby agnimitra » Tue Jan 13, 2009 10:02 am

thanks for the tutorial..
can we change the background to any custom color???
agnimitra
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed Dec 17, 2008 12:08 pm
Location: Bangalore

Postby pskink » Tue Jan 13, 2009 12:10 pm

darolla,

you could also add your modified 'Green Theme' - but with better check/radio buttons (i dont say yours are ugly, but imho dont match rest of the graphics) - maybe you could ask someone with photoshop experience and good aesthetic/graphics feelings - feel free to change mine stuff if its not enough/ugly etc.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby darolla » Tue Jan 13, 2009 2:04 pm

To be honest, I dont have contacts to painters, and I don't have the time due to finishing my computer science studies...

So if anyone is interested, please pm me...

Greetings,
DaRolla
Attachments
theme_darolla_162.png
theme_darolla_162.png (12.6 KiB) Viewed 50110 times
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Postby pskink » Tue Jan 13, 2009 2:39 pm

darolla wrote:and I don't have the time due to finishing my computer science studies...


duties first, pleasure later on, i completely understand :)
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby MrSnowflake » Tue Jan 13, 2009 2:43 pm

The Spirit wrote:is "without theme" the same as the "black theme"?
I seems to me that black team is darker (blacker hehe) as the default theme.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby ananddr » Tue Sep 22, 2009 3:30 pm

[font=Verdana]Hi DaRolla ,

I am getting the following error when i tried the tutorial.
Something is missing some where....
Since i am a novice to java and xml
I am not able to rectify the error....

Can you help me in this ?????

Regards,
Anand.[/font]
ananddr
Freshman
Freshman
 
Posts: 7
Joined: Tue Sep 22, 2009 3:12 pm

Re: Tutorial: UI Themes

Postby mattq » Mon Jun 21, 2010 11:18 pm

I posted an in-depth tutorial about customizable UI themes in Android here: http://www.androidengineer.com/2010/06/ ... tions.html.

-Matt
mattq
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 21, 2010 11:17 pm

Re: Tutorial: UI Themes

Postby pemko » Thu Jul 29, 2010 1:16 pm

how can I make a custom button? i have edited your button but the button is very ugly and stretched too much :(
pemko
Freshman
Freshman
 
Posts: 9
Joined: Fri May 28, 2010 12:17 pm
Location: Switzerland

Re: Tutorial: UI Themes

Postby limteckchai » Wed Aug 18, 2010 11:05 am

I would really hope if any can tell me if it is possible to both implement THEME.NO_TITLEBAR and THEME.LIGHT both at the same time.

And if it is... please show how .. :P

Your contribution to the android society is greatly appreciated.
limteckchai
Experienced Developer
Experienced Developer
 
Posts: 92
Joined: Mon Jun 28, 2010 3:33 am

Re: Tutorial: UI Themes

Postby bogdan71 » Tue Sep 28, 2010 10:15 pm

To create both Light and No Title you can add this to the AndroidManifest.xml

<activity android:name=".SampleActivity"
android:label="@string/app_name" android:theme="@android:style/Theme.Light.NoTitleBar">

Easy enough if you look at the android source code....
bogdan71
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Sep 28, 2010 10:10 pm

Re: Tutorial: UI Themes

Postby vovs » Mon Feb 07, 2011 5:04 pm

when I switch my Activity to use the Theme.Light, it doesn't show the text of the elements.
Here description and screenshot: view-layout-resource-problems-f27/how-to-change-text-color-of-android-s-preferences-t50983.html

Can you help me in this ?
vovs
Developer
Developer
 
Posts: 42
Joined: Thu Jan 27, 2011 7:33 pm
Location: Ukraine

Re: Tutorial: UI Themes

Postby ketankantilal » Tue Apr 19, 2011 10:48 am

Hello darolla,

My question is how did you apply light green theme? Can I change theme using java code? Your help needed.


Thanks,
Ketan
ketankantilal
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Sep 25, 2010 2:46 pm

Top
Next

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests