我有以下代码
string actCancel = "Cancel";
string actDelete = "Delete it";
string actRename = "Rename it";
string action = await DisplayActionSheet($"What do you want to do? \n {pickerSystem.SelectedItem}", actCancel, actDelete, actRename);我希望显示看起来与下面的第二个示例非常相似。
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/pop-ups
指导用户完成任务
..。但事实并非如此,看起来

..。
用户的选择有点分散,并不像文档示例那样整齐地堆叠在一起。是我做错了什么,还是我的期望错了?(安卓视窗,VS2019 Pixel2模拟器)
发布于 2021-03-01 03:10:26
因为您只提供了一个操作,即
至
参数string[]按钮
参数,请在您的代码中指定
至
参数。
需要指定参数
如果您没有使用它,则将其设置为null:
string actCancel = "Cancel";
string actDelete = "Delete it";
string actRename = "Rename it";
string action = await DisplayActionSheet($"What do you want to do? \n {pickerSystem.SelectedItem}",
actCancel, null, actDelete, actRename);下面是
API定义
编辑
Xamarin.Forms正在使用原生安卓对话框
下面是负责创建销毁按钮的代码
,正如您可以看到的,它只是将它映射到对话框的本机“负按钮”,使用
SetNegativeButton()
(
https://developer.android.com/reference/android/app/AlertDialog.Builder#setNegativeButton(java.lang.CharSequence,%20android.content.DialogInterface.OnClickListener%29)
..。
原生Android对话框有一个描述的布局
这里
和
物质的在这里

“否定按钮”在左边的“肯定按钮”旁边。
因此,要实现类似于您附加的链接中的屏幕截图,您可能需要创建自定义本机弹出窗口。
https://stackoverflow.com/questions/66412503
复制相似问题