Customization Bottom Sheet Dialog's View

前端 未结 2 1953
迷失自我
迷失自我 2021-02-09 23:54

I just want to get the bottom sheet dialog like below_: margin from the system window. How can I get like this?

2条回答
  •  失恋的感觉
    2021-02-10 00:15

    Add Dependency

    implementation 'com.baoyz.actionsheet:library:1.1.7'
    

    Add this code in Activity

    public void ButtonActionSheet() {
    
        ActionSheet.createBuilder(this, getSupportFragmentManager())
                .setCancelButtonTitle("Cancel")
                .setOtherButtonTitles("item1", "item2")
                .setCancelableOnTouchOutside(true)
                .setListener(new ActionSheet.ActionSheetListener() {
                    @Override
                    public void onDismiss(ActionSheet actionSheet, boolean isCancel) {
    
                    }
    
                    @Override
                    public void onOtherButtonClick(ActionSheet actionSheet, int index) {
    
                        if (index == 0) {
    
                            myMethod();
    
                        } else if (index == 1) {
    
                            myMethod2();
                        }
                    }
    
    
                })
                .show();
    
    
    
    
    }
    

    Add this line in style.xml

     @style/ActionSheetStyleiOS7
    

提交回复
热议问题