android.support.v7.app.AlertDialog显示异常

来源:互联网 发布:公路车骑行姿势 知乎 编辑:程序博客网 时间:2024/06/09 22:16
final android.support.v7.app.AlertDialog builder = new android.support.v7.app.AlertDialog.Builder(this).create();builder.show();Window window = builder.getWindow();window.setContentView(R.layout.dialog_xieyi);// 设置弹出框加载的布局

原因出在xml布局上

在最外层根布局上添加margin,以实现弹窗边距效果,导致自定义布局无法填充dia窗口。

解决方案,设置子布局的宽度即可。

<com.zhy.autolayout.AutoLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"                                     android:layout_width="wrap_content"                                     android:layout_height="700px"                                     android:background="#ffffff"                                     android:orientation="vertical">    <com.zhy.autolayout.AutoLinearLayout        android:layout_width="660px"        android:layout_height="match_parent"        android:orientation="vertical">


阅读全文
0 0
原创粉丝点击