问题描述
|
有人知道如何为自定义对话框设置边距吗?我之所以问是因为我有一个自定义对话框,但是即使我在布局参数上显式设置了WRAP_CONTENT,但在显示时它会拉伸以填充父对话框。
基本上,对话框包含一个列表视图,该列表视图的元素必须向下滚动,例如,当元素为1时,它不会拉伸,但是当添加更多项时,对话框将占据整个屏幕。
有什么建议么?我尝试了所有可能的解决方案组合,但均未获得令人满意的结果
编辑:添加对话框布局
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
android:layout_width=\"fill_parent\"
android:layout_height=\"wrap_content\"
android:layout_margin=\"50dip\"
android:orientation=\"vertical\"
android:layout_gravity=\"top|center\">
<FrameLayout android:layout_width=\"fill_parent\" android:layout_margin=\"5dip\" android:layout_height=\"wrap_content\">
<TextView android:layout_width=\"wrap_content\" android:layout_height=\"wrap_content\"
android:layout_gravity=\"center\"
android:textSize=\"20sp\" android:textColor=\"@color/black\"/>
<Button android:layout_height=\"32dip\" android:layout_width=\"32dip\"
android:id=\"@+id/guide_dialog_cross_button\"
android:background=\"@drawable/button_cross_white\"/>
</FrameLayout>
<ListView android:layout_width=\"fill_parent\" android:layout_height=\"wrap_content\"
android:fadingEdge=\"none\"
android:layout_margin=\"5dip\"/>
<ImageButton android:layout_width=\"wrap_content\" android:layout_height=\"wrap_content\"
android:layout_margin=\"5dip\" />
</LinearLayout>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)