Customization Bottom Sheet Dialog's View

前端 未结 2 533
花落未央
花落未央 2021-02-09 23:21

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:08

    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
    

提交回复
热议问题