How to use common user interface styles in Android?

I am writing my little Android app. I bring out the dialog control, which is a good, not full-screen dialog with rounded corners by setting android:theme="@android:style/Theme.Dialog" to action in my manifest. Everything works as I expected. However, this is just a gray gray dialog box, as in this screenshot:

default gray dialog look

I noticed, however, that many applications, when they appear in the dialog box, have a beautiful name with a blue name, as in this screenshot.

enter image description here

I would suggest that this topic is a common topic, as it appears in a large number of different applications. I would suggest that this is something built into the OS. (My phone is Captivate with the official release of Froyo). Of course, it MAY be something that each developer has simply transcoded on their own, but I doubt it.

Assuming this is a general topic, how to use it in my application? What changes do I need to make in my activity in order to use this topic?

Thanks in advance!

+4
source share
3 answers

You can configure activity to use the default theme, for example Theme.Black. There are default themes, and they are in R.style - although I'm not sure which of them are available for platforms (for example, I think holon themes for 3.0 and higher ...

http://developer.android.com/reference/android/R.style.html

see here http://developer.android.com/guide/topics/ui/themes.html for defining your own themes and scrolling to the end for using "platform styles" and themes.

+2
source

Rather messy (there’s no good reference for this), but platform styles are defined in \ platform \ android- \ data \ res \ values ​​\ styles.xml and \ platform \ android- \ data \\ resolution values ​​\ themes.xml. You can dig them out and define theme / style identifiers available at compile time.

Furthermore, it is really just a trial version and a bug.

0
source

To create a dialog, you need to expand the dialog class. And to have a nice title bar, you can use:

 requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 

and have your own headline.

to use the header:

 setTitle("MyTitle"); 

You can also assign your own view to the title.

0
source

All Articles