在android中显示对话框时无法设置状态栏颜色

时间:2016-03-28 09:24:27

标签: android

我使用主题 android.R.style.Theme_Translucent_NoTitleBar

 private void popupControl() {
    final AppCompatDialog dialog = new AppCompatDialog(this, android.R.style.Theme_Translucent_NoTitleBar);
    dialog.setContentView(R.layout.popup_control);
    dialog.findViewById(R.id.relative_dialog_control).setVisibility(View.VISIBLE);
    dialog.findViewById(R.id.view_close).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });


    dialog.findViewById(R.id.view_close_top).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
在androidMainfest中

 <activity
        android:name=".activity.MainActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

这是风格

    <style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowEnableSplitTouch">false</item>
    <item name="android:splitMotionEvents">false</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@color/color_bg_splash</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowAllowEnterTransitionOverlap">true</item>
    <item name="android:windowAllowReturnTransitionOverlap">true</item>
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>

enter image description here

当我显示对话框时。 StatusBar颜色不起作用。请。帮帮我?

enter image description here

0 个答案:

没有答案