-
Notifications
You must be signed in to change notification settings - Fork 80
clicked list dialog API for Java
vincent(朱志强) edited this page Sep 15, 2023
·
4 revisions
- 快速上手
- 详细API
SmartDialog.builderOfClickedList()
.items(Arrays.asList("回复", "转发", "私信回复", "复制", "举报"))
.itemClickedListener(new ItemClickedListener() {
@Override
public void onItemClicked(DialogInterface dialog, ClickedItem clickedItem) {
dialog.dismiss();
SmartToast.classic().showInCenter(clickedItem.getValue());
}
})
.build(activity)
.show();
监听器可用lambda简写,
SmartDialog.builderOfClickedList()
.items(Arrays.asList("回复", "转发", "私信回复", "复制", "举报"))
.itemClickedListener((ItemClickedListener) (dialog, clickedItem) -> {
dialog.dismiss();
SmartToast.classic().showInCenter(clickedItem.getValue());
})
.build(activity)
.show();
ClickedListDialogFacade.Handle handle = SmartDialog.builderOfClickedList()
.items(Arrays.asList("回复", "转发", "私信回复", "复制", "举报"))
.itemClickedListener((ItemClickedListener) (dialog, clickedItem) -> {
dialog.dismiss();
SmartToast.classic().showInCenter(clickedItem.getValue());
})
.build(activity);
//显示
handle.show();
//隐藏
handle.dismiss();
//是否正在显示
handle.isShowing();
SmartDialog.builderOfClickedList()
.title("title")
.build(activity)
.show();
或者,
SmartDialog.builderOfClickedList()
.titleResource(R.string.clicked_list_title)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
//颜色,大小(单位sp),是否加粗
.titleStyle(Color.BLUE,18f,false)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
.items(Arrays.asList("回复", "转发", "私信回复", "复制", "举报"))
.build(activity)
.show();
或者,
SmartDialog.builderOfClickedList()
.itemsResource(R.array.clicked_list_items)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
//颜色,大小(sp),是否加粗
.itemStyle(Color.parseColor("#333333"), 14f, false)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
.itemClickedListener(new ItemClickedListener() {
@Override
public void onItemClicked(DialogInterface dialog, ClickedItem clickedItem) {
dialog.dismiss();
//do something with clickedItem
}
})
.build(activity)
.show();
或者简写为,
SmartDialog.builderOfClickedList()
.itemClickedListener((ItemClickedListener) (dialog, clickedItem) -> {
dialog.dismiss();
//do something with clickedItem
})
.build(activity)
.show();
SmartDialog.builderOfClickedList()
//默认为true,也就是常见的配置,dialog显示时,周围背景是灰色蒙层
.dimBehind(true)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
//默认为true
.cancelable(true)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
//默认false
.cancelOnTouchOutside(false)
.build(activity)
.show();
SmartDialog.builderOfClickedList()
.dialogShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
//do something
}
})
.build(activity)
.show();
或者简写成,
SmartDialog.builderOfClickedList()
.dialogShowListener(dialog -> {
//do something
})
.build(activity)
.show();
SmartDialog.builderOfClickedList()
.dialogDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
//do something
}
})
.build(activity)
.show();
或者简写成,
SmartDialog.builderOfClickedList()
.dialogDismissListener(dialog -> {
//do something
})
.build(activity)
.show();
SmartDialog.builderOfClickedList()
.dialogCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
//do something
}
})
.build(activity)
.show();
或者简写为,
SmartDialog.builderOfClickedList()
.dialogCancelListener(dialog -> {
//do something
})
.build(activity)
.show();
1