orhanobut / dialogplus

Advanced dialog solution for android
Apache License 2.0
5k stars 793 forks source link

Rounded corners when tap and hold #181

Open konopkoman opened 5 years ago

konopkoman commented 5 years ago

Please let me set setClipToOutline(true) to round corners when menu item is pressed and hold. In my case I set Adapter with menu item, then I use setContentBackgroundResource to set rounded corners for dialog (top-lefr, top-right) and this works fine. But when I press a menu item, corners of pressed item is still visible. Please see my code bolow.

        dialogContextMenu = DialogPlus.newDialog(getContext())
                .setAdapter(adapter)
                .setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
                        //some logic
                        dialogContextMenu.dismiss();
                    }
                })
                .setExpanded(false)
                .setContentBackgroundResource(R.drawable.bg_rounded_menu_bottom)
                .setContentHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
                .create();
        dialogContextMenu.getHolderView().setClipToOutline(true); //todo fix rounded corners then pressed, currently it doesn't works
        dialogContextMenu.show();