【2025年1月2日】关于腾讯云小程序平台更名为腾讯云超级应用服务的公告
控制台更新动态
Android SDK 更新动态
iOS SDK 更新动态
Flutter 更新动态
IDE 更新动态
基础库更新动态
/*** 通用 ActionSheet 展示接口* @param context 上下文* @param actionSheetInfo ActionSheet 信息* @return true 表示使用自定义 ActionSheet,false 表示使用 SDK 默认 ActionSheet*/boolean showActionSheet(Activity context, ActionSheetInfo actionSheetInfo);
@Overridepublic boolean showActionSheet(Activity context, ActionSheetInfo actionSheetInfo) {ActionSheet actionSheet = ActionSheet.create(context);// 设置标题if (actionSheetInfo.getTitle() != null) {actionSheet.setMainTitle(actionSheetInfo.getTitle());}// 设置是否可取消actionSheet.setCancelable(actionSheetInfo.isCancelable());// 添加itemsif (actionSheetInfo.getItems() != null) {for (ActionSheetItem item : actionSheetInfo.getItems()) {if (item.getTextColor() != null) {actionSheet.addButton(item.getText(), ActionSheet.CUSTOM_TEXT_COLOR_BTN,String.format("#%08X", item.getTextColor()));} else {actionSheet.addButton(item.getText(), ActionSheet.GRAY_STYLE_BTN);}}}// 设置取消按钮文本if (actionSheetInfo.getCancelText() != null) {actionSheet.addCancelButton(actionSheetInfo.getCancelText());}// 设置点击监听器if (actionSheetInfo.getItemClickListener() != null) {actionSheet.setOnButtonClickListener(new ActionSheet.OnButtonClickListener() {@Overridepublic void onClick(View clickedView, int which) {actionSheetInfo.getItemClickListener().onClick(which);actionSheet.dismiss();}});}// 设置取消监听器if (actionSheetInfo.getCancelListener() != null) {actionSheet.setOnDismissListener(new ActionSheet.OnDismissListener() {@Overridepublic void onDismiss() {actionSheetInfo.getCancelListener().onCancel(null);}});}if (!context.isFinishing() && !actionSheet.isShowing()) {actionSheet.show();}return true;}
文档反馈