1.描述
当我将application 主题设置为 Theme.Light.NoTitleBar时,
在某个Activity使用Dialog时, Dialog的背景色仍未黑色
2.解决办法
声明全局变量
ContextThemeWrapper themedContext;
onCreate方法中实例化
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ) {
themedContext = new ContextThemeWrapper( FreeDraw.this, android.R.style.Theme_Holo_Light_Dialog_NoActionBar );
}
else {
themedContext = new ContextThemeWrapper( FreeDraw.this, android.R.style.Theme_Light_NoTitleBar );
}
Dialog使用
Dialog dialog = new Dialog(themedContext);