У меня есть класс DialogFragment со следующим кодом:
public class LeavingAppDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View v = inflater.inflate(R.layout.leaving_app_dialog, null);
builder.setView(v);
Typeface segoeuib = Typeface.createFromAsset(getActivity().getApplicationContext().getAssets(), "fonts/segoeuib.ttf");
TextView text = (TextView) v.findViewById(R.id.msg_dialog);
text.setTypeface(segoeuib);
Dialog dialog = builder.create();
return dialog;
}
}
Этот диалог использует пользовательский макет, вот его код:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<ImageView
android:layout_width="300dp"
android:layout_height="300dp"
android:id="@+id/imageView"
android:src="@drawable/box_1_fit"
android:scaleType="centerInside"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="#00000000" />
<FrameLayout
android:layout_width="275dp"
android:layout_height="150dp"
android:id="@+id/frameLayout"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="LEAVING THIS APP?"
android:id="@+id/msg_dialog"
android:textSize="35dp"
android:layout_gravity="center_horizontal|top"
android:gravity="center_horizontal|top"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</FrameLayout>
<Button
android:layout_width="100dp"
android:layout_height="37dp"
android:id="@+id/btn_cancel"
android:background="@drawable/cancel_button_fit"
android:singleLine="false"
android:layout_alignRight="@+id/frameLayout"
android:layout_alignEnd="@+id/frameLayout"
android:layout_marginTop="75dp"
android:layout_below="@+id/frameLayout"
android:layout_marginRight="25dp"
android:onClick="ExitApp"/>
<Button
android:layout_width="100dp"
android:layout_height="37dp"
android:id="@+id/btn_accept"
android:background="@drawable/accept_button_fit"
android:layout_below="@+id/frameLayout"
android:layout_alignLeft="@+id/frameLayout"
android:layout_alignStart="@+id/frameLayout"
android:layout_marginTop="75dp"
android:layout_marginLeft="25dp"
android:onClick="ExitApp"/>
</RelativeLayout>
</RelativeLayout>
Проблема на скриншоте. Мне нужно избавиться от этих белых границ. Я пытался установить прозрачный цвет фона через редактор макета и через код. Я пытался установить прозрачный цвет фона для всех макетов и для самого изображения, но все это не имело никакого эффекта. Мое исходное изображение представляет собой файл png, и у него действительно прозрачный фон, поэтому проблема не в исходном изображении.