courtesy this amazing old post where there was a similar problem a few years ago: https://mcmap.net/q/110260/-how-to-programatically-theme-an-activity-to-be-like-a-dialog
4.2RC1 Workaround:
(1) It's yet another droid activity/theme bug
(2) In manifest you MUST set the theme to Theme.AppCompat.Dialog
// side menu
<activity android:name=".. LeftMenu" android:theme="@style/Theme.AppCompat.Dialog" />
<!-- beware of insane droid transparent activity bug... -->
(3) Only in code, can you set the theme to your theme. (Do so before super)
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.YourTransparentTheme);
super.onCreate(savedInstanceState);
setContentView(R.layout.aty_leftmenu);
}
(4) Your own theme in styles will be:
<style name="YourTransparentTheme" parent="YourGeneralTheme">
<item name="android:windowBackground">@android:color/transparent</item>
.. and other colors etc you desire ..
</style>
Details on why you only need windowBackground: https://mcmap.net/q/53180/-how-do-i-create-a-transparent-activity-on-android
In summary the workaround for the bug is:
Must set Theme.AppCompat.Dialog in manifest. You may only set your own style in onCreate.
(Aside: Note that it is no problem if most of your activities have a title bar (so based on Theme.AppCompat.Light), but your transparent activity has no title bar (so based on Theme.AppCompat.Light.NoActionBar). In that way you can have the usual thing where a "left menu" or similar covers also the title bar of the main app.)