- // 创建并显示
- ActionSheet.createBuilder(this, getSupportFragmentManager())
- .setCancelButtonTitle("Cancel")
- .setOtherButtonTitles("Item1", "Item2", "Item3", "Item4")
- .setCancelableOnTouchOutside(true).setListener(this).show();
- // 事件监听
- @Override
- public void onOtherButtonClick(ActionSheet actionSheet, int index) {
- Toast.makeText(getApplicationContext(), "click item index = " + index,
- 0).show();
- }
- @Override
- public void onCancel(ActionSheet actionSheet) {
- Toast.makeText(getApplicationContext(), "cancel", 0).show();
- }
- @Override
- public void onDismiss(ActionSheet actionSheet) {
- Toast.makeText(getApplicationContext(), "dismissed", 0).show();
- }
- //该片段来自于http://www.codesnippet.cn/detail/2907201513262.html
来源: http://www.codesnippet.cn/detail/2907201513262.html