Strange white border behind dialogue

I have a strange problem with my android app. Some time ago I noticed that sometimes there is a strange white border behind the dialogs:

a busy cat

The problem exists in both the emulator and my phone. The border seems to disappear after showing a few dialogs. This can be seen in both my custom dialog snippet and the dialogs in the preferences screen.

I am not using the support library (11 is my minimal SDK). My phone and emulator are running Android 4.0.4.

Does anyone know what's going on?

UPDATE: Example code for one of the dialogs:

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MainActivity activity = (MainActivity) getActivity();
    LayoutInflater inflater = activity.getLayoutInflater();

    Bundle arguments = getArguments();

    String message = arguments.getString(MESSAGE_BUNDLE_KEY);
    if (message == null) {
        message = getString(R.string.please_wait);
    }

    View dialogView = inflater.inflate(R.layout.dialog_progress, null);
    TextView messageTextView = (TextView) dialogView
            .findViewById(R.id.progress_dialog_message);
    messageTextView.setText(getString(R.string.please_wait));
    messageTextView.setTypeface(activity.getRedkneeFont());
    setRetainInstance(true);

    return new AlertDialog.Builder(getActivity()).setView(dialogView)
            .create();
}

      

XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ProgressBar
    android:id="@+id/progress_dialog_progress_bar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="17dp"
    android:layout_marginTop="17dp" />

<TextView
    android:id="@+id/progress_dialog_message"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/progress_dialog_progress_bar"
    android:layout_marginLeft="19dp"
    android:layout_marginTop="12dp"
    android:layout_toRightOf="@+id/progress_dialog_progress_bar"
    android:text="Medium Text"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<View
    android:id="@+id/progress_dialog_margin_view"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/progress_dialog_progress_bar"
    android:layout_marginTop="17dp"
    android:background="@color/separator_blue" />

      

UPDATE: When I switched to the support library (now all snippets are imported from appcompat) the border is gone. Bug?

+3


source to share


1 answer


Try applying the theme in the dialog constructor to a semi-transparent



SetStyle (R.style.Theme.AppCompat.Translucent);

+1


source







All Articles