set the Translucent theme in the AndroidManifest.xml and use setTheme(). It seems strange but it works.
To enable translucent is only possible in manifest. I guess. To disable translucent is possible in manifest and java code. Also remember that setTheme() has to be before super.onCreate(); On Jun 16, 10:37 pm, droidsan <[email protected]> wrote: > Depending on an extra value of the Intent that starts my Activity the > Activity should show up withtranslucentor solid background. > Therefore, I use the following code in my Activity's onCreate method: > > if (getIntent().getBooleanExtra("transparent", false)) { > setTheme(android.R.style.Theme_Translucent); > } > else { > setTheme(android.R.style.Theme_Black); > } > > setContentView(R.layout.main); > > However, with this code the background of my Activity never > becomestranslucent, even if setTheme(android.R.style.Theme_Translucent) is > called. (The same code works well when using themes that only set font > sizes). > > I assume that the background for my Activity is already set during > inflation of the Activity and that setContentView only puts my View > (i.e. R.layout.main) on top of this background. > > Is there a way to change translucency of my Activity from Java code? > > Thanks for your help. > > Droidsan. -- 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

