我想使用圖像作爲我的加載對話框的背景。對話應該是全屏的,但我得到的是這樣的......全屏加載對話框將不會完全全屏
如何使對話填滿屏幕,所以我沒有那個白色邊框?
繼承人我佈局的xml ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/locating"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/kumalocating">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="LOCATING OFFERS IN YOUR AREA"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="30sp"
android:textStyle="bold" />
</RelativeLayout>
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/loader_1" />
</RelativeLayout>
和我的課......
public class SpinnerDialog extends DialogFragment {
private static String message;
public SpinnerDialog() {
// use empty constructors. If something is needed use onCreate's
message = null;
}
public static SpinnerDialog spinnerWithCustomMessage(String msg) {
SpinnerDialog d = new SpinnerDialog();
message = msg;
return d;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fill_dialog, container);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
代碼顯示:
spinnerDialog = SpinnerDialog.spinnerWithCustomMessage(getString(R.string.loading_message));
spinnerDialog.show(getFragmentManager(), null);
這就是對話框片段的行爲,但是你可以覆蓋它通過https://stackoverflow.com/a/25623185/2700586 – Mani
@Mani我不能讓它與視圖工作。我編輯我的問題,以顯示Java代碼 –
發佈代碼如何顯示spinnerdialog – Mani