martinSongzq 2015-01-19 04:09 采纳率: 0%
浏览 1649

关于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();
                }
            }
        });
    }

  • 写回答

2条回答 默认 最新

  • danielinbiti 2015-01-19 04:44
    关注

    把你的布局文件先贴出来

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 matlab解优化问题代码
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?