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

Background color is reset when slider closed #2712

Closed AlexMercier closed 3 years ago

AlexMercier commented 3 years ago

About this issue

I have 2 drawer sliders - left and right. With left slider I have no issue.

But right slider shows correctly only when I show it first time at app run. At the next times this slider displayed without my background color and have margins with left and right.

the xml layout of sliders:

<androidx.drawerlayout.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/drawerLayoutMain"
    android:background="@color/background_activity"
    android:fitsSystemWindows="true" >

     .......

    <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
        android:id="@+id/slider"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true" />

    <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
        android:id="@+id/slider_categories"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:fitsSystemWindows="true" />

</androidx.drawerlayout.widget.DrawerLayout>

This how I show my slider: drawerLayoutMain.openDrawer(slider2) and close drawerLayoutMain.closeDrawer(slider2)

Issue video. and for exaple I set red background color:

Image

Details

mikepenz commented 3 years ago

~AlexMercier I looked through the library code. I can't find a single location where the library would change the DrawerLayout background.~

~The project would use the DrawerLayout only as its host + reference it to close it on clicks.~

~At the moment this issue looks to be located somewhere else. But I will look further regardless~

Looking again over the things. I totally overlooked that you are not changing the DrawerLayout background, but the slider background instead

mikepenz commented 3 years ago

Trying to achieve the same fails. I put

Screenshot 2021-03-05 at 17 48 11

into the sample app, but it would not show the same behaviour as seen above

mikepenz commented 3 years ago

Please provide a sample app to showcase the problem.

Closing due to inactivity for the time being