I have a DialogFragment (from android.support.v4.app.DialogFragment
) where the activity behind dims perfectly as expected on my Android 5.1 (Lollipop). But on Kitkat, the dimming does not work.
I tried the following solutions but failed:
Am I missing something? TIA.
EDIT 1:
This is my onCreateDialog
method of the DialogFragment
.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View layout = inflater.inflate(R.layout.fragment_dialog, null);
...
// set textfield listeners here
...
builder.setView(layout);
return builder.create();
}
Here is my DialogFragment
layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
...
</LinearLayout>
As you can see, I am not doing anything special in my layout xml.
And this is how I call the dialog up:
MyDialogFragment dialog = new MyDialogFragment();
dialog.setListener(this);
dialog.setCallingActivity(this);
FragmentManager fm = getSupportFragmentManager();
dialog.show(fm, "MyDialogFragment");