Technically, a theme is a style, but it's special in that it has
attributes for other views, and in how it's used (associated with a
Context, rather than a view).
And please disregard what I previously wrote about possibly needing to
use a ContextThemeWrapper - Dialog already has code to insert one of
those between itself and the parent activity. That's how a dialog can
have its own theme, independent of the parent activity's theme:
> public Dialog(Context context, int theme) {
> mContext = new ContextThemeWrapper(
> context, theme == 0 ? com.android.internal.R.style.Theme_Dialog : theme);
-- Kostya
02.03.2011 8:59, William Ferguson пишет:
> The simplest solution I found was to :
>
> Instantiate a Dialog with a Theme that sets the windowBackground to my
> custom background, inflate my custom layout that has its views styled
> for the requisite font color etc, and insert my custom layout into the
> Dialog using #Dialog#addContentView
>
> <style name="DialogTheme" parent="android:style/Theme.Dialog">
> <item name="android:windowBackground">@drawable/dialog_background</
> item>
> <item name="android:windowNoTitle">true</item> <!-- Hides the Dialog
> title bar View. -->
> </style>
>
> I did the above in a very simple Dialog factory, but you could just as
> easily subclass DIalog and do it in the constructor.
> Create a class that extends Dialog and in its construcor.
>
> I wish I done this earlier rather than trying to fruitlessly style the
> existing ProgressDialog.
>
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment