自定义警告对话框中收到骚扰填充 [英] custom alert dialog getting unwanted padding

查看:126
本文介绍了自定义警告对话框中收到骚扰填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使自定义警告对话框,它主要是工作得很好。该功能可以正常使用,但认为是表现在一个奇怪的方式。该对话框布局由一个按钮和一个列表视图中。你会在按钮下面的截图中看到越来越顶部和底部的余量。

I have tried to make a custom alert dialog and it mostly works very well. the functionality is working perfectly but the view is behaving in a weird way. The dialog layout consists of a button and a listview. as you will see in the screenshot below the button is getting a margin on top and bottom.

我不认为有任何理由为这些利润,我会大大AP preciate一些帮助:)

i dont see any reason for these margins, and i would greatly appreciate some help :)

由于某种原因,我不能发表我的XML布局,但我可以可以确定地告诉你它包含任何形式的补白或利润

for some reason i cant post my xml layout but i can asure you that it contains no paddings or margins of any kind

Java的code:

Java Code :

View dialogView = ((LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.choose_catagory_dialog_layout, null, false);
Button footerButton = (Button) dialogView.findViewById(R.id.choose_catagory_dialog_footer_button);
footerButton.setOnClickListener(ButtonClickEvent);

builder = new AlertDialog.Builder(mContext);
builder.setView(dialogView);
builder.setTitle(R.string.choose_catagory);

builder.setAdapter(spinnerAdapter, ListclickEvent);
alert = builder.create();
alert.getListView().setVerticalFadingEdgeEnabled(false);
alert.setOwnerActivity((Activity) mContext);

截图:

推荐答案

的CustomPanel的 AlertDialog 有5DP顶部和底部填充。您可以将这些使用覆盖:

The CustomPanel of an AlertDialog has a 5dp top and bottom padding. You can override these using:

alert.setView(dialogView, 0, 0, 0, 0);

这篇关于自定义警告对话框中收到骚扰填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆