关于android UI的问题,各位大神支支招呀!

是这样的,我现在在做一个自定义的弹框,弹框布局是RelativeLayout的,背景是美工提供的一个框,框内填充满了颜色。问题来了,偶尔的情况下我切换其他程序的时候(或者是切换到桌面)然后切换回来,自定义弹框的背景没掉了一块,背景只显示了部分。。请问大家这是什么原因~?各位大神!

下面是我弹出框的代码片段:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="407dp"
    android:layout_height="wrap_content"
    android:background="@drawable/background_1">

    <TextView
        android:id="@+id/tv_download_no_net_notice"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="53dp"
        android:text="@string/no_net_downloading"
        android:textSize="15sp"
        android:textColor="#ffd956" />

    <ImageButton
        android:id="@+id/btn_redownload"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tv_download_no_net_notice"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="28dp"
        android:background="@drawable/button_retry" />

</RelativeLayout>


oNetDialog() throws Exception {
        downloadNoNetDialog = DialogHelper.createAlertDialog(appActivity);
        Log.i(LogDebuger.DOWNLOAD, "SHOW");
        Window window = downloadNoNetDialog.getWindow();
        window.setContentView(R.layout.dialog_no_net_while_download);
        DialogHelper.setNullBackground(window);
        ImageButton retryButton = (ImageButton) window.findViewById(R.id.btn_redownload);

        retryButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    if (NetworkTool.isNetworkAvaliable(mContext)) {
                        downloadApk();
                        downloadNoNetDialog.dismiss();
                        Log.i(LogDebuger.DOWNLOAD, "DISMISS");
                        showDownloadDialog();
                    } else {
                        Toast.makeText(appActivity, "当前网络不可用", Toast.LENGTH_SHORT).show();
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

把你的布局文件先贴出来

横竖屏原因。有几种方式:
1、自定义根节点RelativeLayout ,重写onLayout
2、增加横屏布局文件
3、在XML中配置强制横屏。