XML : My activity which calls DialogFragment is not dimmed

My activity is completely blacked (area outside of DialogFragment) when it calls DialogFragment (which is originally supposed to be dimmed).

Here is my source code, relevant part in DialogFragment class:

      @Override      public void onStart() {          super.onStart();            Window window = getDialog().getWindow();          WindowManager.LayoutParams windowParams = window.getAttributes();          windowParams.dimAmount = 0;          windowParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;          window.setAttributes(windowParams);      };        @Override      public Dialog onCreateDialog(Bundle savedInstanceState) {          Dialog dialog;          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());          builder.setTitle(R.string.copy_contacts);          builder.setMessage(R.string.copy_contact_message);          builder.setPositiveButton(R.string.sp_Yes_SHORT, this);          builder.setNegativeButton(R.string.sp_No_SHORT, this);          dialog = builder.create();          return dialog;      }    

My custom DialogFragment class is set to be an inner class inside the Activity.

Here is the part of .xml source code of the theme of the Activity:

AndroidManifest.xml:

  <activity>          android:name=".copy.TheActivity"          android:configChanges="keyboardHidden|orientation|screenSize"          android:label="@string/copy_contacts"          android:theme="@style/TransparentTheme" >  </activity>    

Styles.xml:

  <style name="TransparentTheme" parent="InsertOrEditGroupDialogTheme">      <item name="android:backgroundDimEnabled">true</item>      <item name="android:windowActionBar">false</item>  </style>  <style name="InsertOrEditGroupDialogTheme" parent="WhiteNoActionBarTheme">      <item name="android:windowCloseOnTouchOutside">false</item>  </style>    

How can I fix this?

No comments:

Post a Comment