c# - 如何在 Xamarin android c# 中设置 AlertDialog 框的宽度和高度?

标签 c# android xamarin-studio

谁能告诉我如何在 xamarin C# 中设置警告对话框的宽度和高度。我已经为对话框设置了布局,但它显示的布局宽度较短。下面是我的代码,提前谢谢大家。我试着寻找我能找到的所有内容都是针对 android java 平台的。

代码:

var alert = new AlertDialog.Builder(this);
                alert.SetView(LayoutInflater.Inflate(Resource.Layout.SuccessPage, null));
                alert.Create().Show();

最佳答案

使用 Window 属性访问布局尺寸:

alert.Window.SetLayout(400, 450);

另一种实现目标的方法是通过 XML 覆盖 alertDialog 的样式,但是您没有显示到目前为止编写的标记。

关于c# - 如何在 Xamarin android c# 中设置 AlertDialog 框的宽度和高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31189284/

相关文章:

c# - I/O操作中的多线程?

android - Flutter Android SDK 版本 28 错误,但我使用的是 30

xamarin - 签署 Ad Hoc android APK : startIndex cannot be larger than length of string 时出错

visual-studio - Xamarin - 无法重命名 'Drawable'。没有更多可用的内部文件标识符

c# - 将 DataGridView Column 更改为 DataGridViewComboBoxColumn 入站 DataGridView

c# - 将日期时间从 GMT 转换为其他(东部、山区、太平洋、印度等)格式

c# - 为什么我不能在同一个类上使用 WCF DataContract 和 ISerializable?

android - 运行模拟器时出现安装错误: INSTALL_FAILED_INSUFFICIENT_STORAGE?

java - 在java中解析xml字符串时出现问题

c# - 如何将 Android 应用程序连接到 Xamarin 中的远程数据库服务器?