Skip to content

Commit

Permalink
- fix elevation shadow showing up
Browse files Browse the repository at this point in the history
  - FIX #2689
  • Loading branch information
mikepenz committed Dec 21, 2020
1 parent 16db678 commit 037953d
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ internal fun handleHeaderView(sliderView: MaterialDrawerSliderView) {
layoutParamsListView.addRule(RelativeLayout.BELOW, R.id.material_drawer_sticky_header)
sliderView.recyclerView.layoutParams = layoutParamsListView

//set a background color or the elevation will not work
it.background = sliderView.background

if (sliderView.stickyHeaderShadow) {
//add a shadow
if (Build.VERSION.SDK_INT >= 21) {
it.background = ColorDrawable(Color.WHITE) // set a background color or the elevation will not work, this is meant to be
it.elevation = sliderView.context.resources.getDimensionPixelSize(R.dimen.material_drawer_sticky_header_elevation).toFloat()
} else {
val view = View(sliderView.context)
Expand All @@ -130,6 +128,7 @@ internal fun handleHeaderView(sliderView: MaterialDrawerSliderView) {
}
if (Build.VERSION.SDK_INT >= 21) {
sliderView.elevation = 0f
sliderView.recyclerView.elevation = 0f
}
//remove the padding of the recyclerView again we have the header on top of it
sliderView.recyclerView.setPadding(0, 0, 0, 0)
Expand Down

0 comments on commit 037953d

Please sign in to comment.