单选项弹窗
2023-01-24 09:16:15 最后更新
//代码出自1335347584
cls("android.support.v7.app.AlertDialog$Builder",class)
javanew(dialog,class,"Context",activity)
javax(null,dialog,class,"setTitle","CharSequence","菜单")
//设置标题
s menu="一;二;三;四"
//设置菜单文本
sl(menu,";",items)

cls("android.content.DialogInterface$OnClickListener", 事件类)
javacb(事件, 事件类)
{
  sgsz(st_aS,1,mult)
  syso(mult)
  //列表项是0开始,也就是0,1,2,3,分别代表一,二,三,四
  f(mult==0)
  {
    tw("一")
  }
  f(mult==1)
  {
    tw("二")
  }
  //...
}

//第二个参数是打开时哪一个勾选上的,0开始
javax(null,dialog,class,"setSingleChoiceItems","CharSequence[]",items,"int",0,事件类,事件)

javax(null,dialog,class,"setTitle","CharSequence","菜单")
javacb(按钮事件, 事件类)
{
  tw("事件")
}
javax(null, dialog, class, "setPositiveButton", "CharSequence", "右边按钮", 事件类, 按钮事件)

javax(dialog,dialog,class,"show")
//显示