Reputation: 63
I have a weird problem with my Android app. Some time ago I noticed that sometimes behind dialogs there is a weird white border:
The problem exist in both emulator and on my phone. Border seems to disappear after showing few dialogs. It's visible in both my custom dialogs fragment and on dialogs on preference screen.
I am not using support library (11 is my minimum sdk). My phone and emulator run on Android 4.0.4.
Anyone know what is going on?
EDIT: An example code of one of 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" />
EDIT: When I switched to Support Library (all fragments are now imported from appcompat), the border disappeared. A bug?
Upvotes: 3
Views: 863
Reputation:
Try to apply theme on your Dialog constructor to Translucent
setStyle(R.style.Theme.AppCompat.Translucent);
Upvotes: 1