标签:klist ide 需要 inter 详细 list context false btn
public class DialogUtils { public interface OnOkOrCancelClickListener{ void clickLeftCancelButton(); void clickRightOKButton(); } public static void createDialogForPortrait(Context context, String content, final OnOkOrCancelClickListener onOkOrCancelClickListener) { final NormalDialog dialog = new NormalDialog(context); dialog.isTitleShow(false)// .bgColor(Color.parseColor("#383838"))// .cornerRadius(5)// .content(content)// .contentGravity(Gravity.CENTER)// .contentTextColor(Color.parseColor("#ffffff"))// .dividerColor(Color.parseColor("#222222"))// .btnTextSize(15.5f, 15.5f)// .btnTextColor(Color.parseColor("#ffffff"), Color.parseColor("#ffffff"))// .btnPressColor(Color.parseColor("#2B2B2B"))// .widthScale(0.8f)// .autoDismiss(false) .show(); dialog.setCanceledOnTouchOutside(false);//点击屏幕外是否小时dialog,true消失,false不消失 dialog.setOnBtnClickL( new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickLeftCancelButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }, new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickRightOKButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }); } public static void createDialogForPortrait(Context context,String[] btnTexts, String content, final OnOkOrCancelClickListener onOkOrCancelClickListener) { //如果需要显示 final NormalDialog dialog = new NormalDialog(context); dialog.isTitleShow(false)// .bgColor(Color.parseColor("#383838"))// .cornerRadius(5)// .content(content)// .contentGravity(Gravity.CENTER)// .contentTextColor(Color.parseColor("#ffffff"))// .dividerColor(Color.parseColor("#222222"))// .btnTextSize(15.5f, 15.5f)// .btnTextColor(Color.parseColor("#ffffff"), Color.parseColor("#ffffff"))// .btnPressColor(Color.parseColor("#2B2B2B"))// .widthScale(0.80f)// .btnText(btnTexts) .autoDismiss(false) .show(); dialog.setCanceledOnTouchOutside(false); dialog.setOnBtnClickL( new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickLeftCancelButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }, new OnBtnClickL() { @Override public void onBtnClick() { onOkOrCancelClickListener.clickRightOKButton(); if (dialog.isShowing()) { dialog.dismiss(); } } }); } }
需要添加依赖:
implementation ‘com.flyco.dialog:FlycoDialog_Lib:1.3.2@aar‘
详细内容可以查看这个开源框架,gitHub地址为:https://github.com/H07000223/FlycoDialog_Master
标签:klist ide 需要 inter 详细 list context false btn
原文地址:https://www.cnblogs.com/yangms/p/10059849.html