My guess is that the dialog theme does not make it a true dialog... It is probably using a 9-patch drawable to make it look like a dialog. Therefore, when you change the background you are drawing over the drawable and it no longer looks like a dialog.
Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Tue, Oct 18, 2011 at 1:00 AM, Amit <[email protected]> wrote: > Thanks for the reply. > > I put almost the same code (removed <item > name="android:colorBackground">@color/bg_color</item> > ) in a new resource file and saw the background color changed, though > it doesn't look like a dialog at all and covers full screen. > > All I want to change the background color of the dialog except the > title bar. Futher help is really appreciated. > > > > On Oct 17, 9:15 pm, Justin Anderson <[email protected]> wrote: > > *> If you want your style to be used as theme ,you have to put your style > > > > > in theme.xml not style.xml.This you can find developer's guide also.* > > > > This is not correct... According to the developer's guide ( > http://developer.android.com/guide/topics/ui/themes.html), the name of the > > file is arbitrary: > > > > *"To create a set of styles, save an XML file in the res/values/ > directory > > of your project. The name of the XML file is arbitrary, but it must use > the > > .xml extension and be saved in the res/values/ folder." > > * > > It also further states the following about the different between styles > and > > themes: > > > > *"A theme is a style applied to an entire > > Activity< > http://developer.android.com/reference/android/app/Activity.html>or > > application, rather than an individual > > View <http://developer.android.com/reference/android/view/View.html> (as > in > > the example above). When a style is applied as a theme, every View in the > > Activity or application will apply each style property that it supports. > For > > example, you can apply the same CodeFont style as a theme for an Activity > > and then all text inside that Activity will have green monospace font." > > * > > The fact that there are styles.xml and themes.xml files merely seems to > be a > > convention and Android does not distinguish by the filename. The > difference > > between a style and a theme is where it is applied (activity level or > view > > level). > > > > Thanks, > > Justin Anderson > > MagouyaWare Developerhttp://sites.google.com/site/magouyaware > > > > On Mon, Oct 17, 2011 at 10:04 AM, gyanu maharjan <[email protected] > >wrote: > > > > > > > > > If you want your style to be used as theme ,you have to put your style > > > in theme.xml not style.xml.This you can find developer's guide also. > > > > > On Oct 17, 6:30 pm, Amit <[email protected]> wrote: > > > > I have a PreferenceActivity which displays items in a list view. I > > > > applied theme as Theme.Dialog in AndroidManifest.xml and it looks > like > > > > a dialog with black color background. To change the background I did > > > > the following changes: > > > > > > style.xml > > > > > > <style name="CustomTheme" parent="android:Theme.Dialog"> > > > > <item name="android:windowBackground">@color/bg_color</item> > > > > <item name="android:colorBackground">@color/bg_color</item> > > > > </style> > > > > > > color.xml > > > > > > <color name="bg_color">@android:color/white</color> > > > > > > AndroidManifest.xml > > > > > > <activity android:name=".PrefActivity" > > > > android:theme="@style/CustomTheme" > > > > android:excludeFromRecents="true" > > > > </activity> > > > > > > Now, neither I see the screen as dialog(appears as full screen) nor > > > > the color as white. Please help me if I am missing something here. Or > > > > do we have a better alternative to change the color for the above > > > > mentioned scenario. > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en- Hide quoted > text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

