AlertDialog error for action context bar in support library 22.2?

I think I found an error in the Material AlertDialog of the support library 22.2, but first I want to check it with the community. The context action bar for copy / cut text does not work well with "android.support.v7.app.AlertDialog".

The result using the android.support.v7.app.AlertDialog file (the text / text in the action bar is not at the top and it is impossible to click the buttons):

enter image description here

If I just changed the import to use "android.app.AlertDialog", the action bar looks at the top:

enter image description here

The code:

styles.xml:

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowActionModeOverlay">true</item>
    <item name="android:windowActionModeOverlay">true</item>
</style>

Code from the fragment that opens the dialog:

public static class MyDialogFragment extends DialogFragment {
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new          AlertDialog.Builder(getActivity());
        LayoutInflater inflater = getActivity().getLayoutInflater();
        builder.setView(inflater.inflate(R.layout.my_dialog, null))
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                    }
                })
                .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                    }
                });
        return builder.create();
    }
}

my_dialog.xml:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">

  <EditText
      android:hint="Text here"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />
  </LinearLayout>

So, this is the error "android.support.v7.app.AlertDialog" correctly?

+4
source

All Articles