当前位置: 代码迷 >> Android >> 问一个AlertDialog全屏有关问题
  详细解决方案

问一个AlertDialog全屏有关问题

热度:24   发布时间:2016-04-28 04:51:54.0
问一个AlertDialog全屏问题?
xml<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="center"
        android:background="@color/cl_beige"
        android:layout_weight="9" >
        <ImageView
            android:id="@+id/imageview_copyright"
            android:src="@drawable/ic_copyright"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerInside" />
    </RelativeLayout>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="center"
        android:background="@color/cl_beige"
        android:layout_weight="1" >
        <TextView
            android:id="@+id/textview_copyright"
            android:background="@color/cl_beige"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textColor="@color/cl_black"
            android:text="COPYRIGHT OF ..."  />
    </RelativeLayout>
</LinearLayout>


下面代码一个启动activity的onCreate过程上

AlertDialog dialog;
        LayoutInflater layoutInflater = LayoutInflater.from(ct);
        final View view = layoutInflater.inflate(id, null);
        dialog = new AlertDialog.Builder(ct).create();
        dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        dialog.setView(view,0,0,0,0);//view,viewSpacingLeft,viewSpacingTop,viewSpacingRight,viewSpacingBottom


结果还是无法全屏啊。麻烦告诉解答一下,谢谢!

------解决方案--------------------
将dialog设置成系统警告级别  然后全屏  可以屏蔽home键 懂吗?  不懂就在那说人脑子有病 真s b
  相关解决方案