mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

Just a rounded corner feature. #2769

Closed adesun2k closed 2 years ago

adesun2k commented 2 years ago

Hi Mike, Great job. Please can we have a drawer with rounded corners? Thanks

mikepenz commented 2 years ago

This should not require any changes within the library. The DrawerLayout is responsible to view the slider view within the drawer. Wheras the slider is just a normal view hierarchy.

This means you should be able to use Android APIs to apply some rounded corners like:

sliderView.outlineProvider = object : ViewOutlineProvider() {
        override fun getOutline(view: View, outline: Outline) {
            outline.setRoundRect(0, 0, view.width, view.height, context.resources.getDimension(R.dimen.corner_radius))
        }
    }
sliderView.clipToOutline = true

The above will round all corners of the rectangle, but with a different outline provider you can adjust it to only round some corners

adesun2k commented 2 years ago

Thanks Mike. You are just the best.