Closed demandedcross closed 9 years ago
This doesn't seem to be an issue associated with this project. Have you tried a forum for the effect? Also post some prints could help solving the problem.
To me it seems like a problem due to using a fragment to load in the drawer, I may be wrong however. I followed answers on SO to get to the point I'm at, there's nothing different between the answers there and what I have aside from the way the drawer itself is implemented. I'll post an issue on SO though if that would be more appropriate.
If your issues is your system bar not getting the color you defined I had the same problem before. Check this commit that fixed the issue: 2f680b765de470aa7c8f83d65923708ffae67672
I don't think that helps, no matter, I'll ask on SO. But maybe as an improvement to your template, look at using ScrimInsetLayout to display under and through the status bar as a few apps are doing this now and I think it would be a good addition :)
Could you post your behavior and some expected behavior? screenshots preferably. Also what is the code of your ScrimInset Layout?
Can't really post screenshots I'm afraid, expected behaviour is like that in Hangouts or the Play store, behaviour I'm getting is a solid status bar, content is behind it though. Also I meant ScrimInsetFrameLayout, found here: https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/ScrimInsetsFrameLayout.java
after following answers on SO such as this one: http://stackoverflow.com/questions/26745300/navigation-drawer-semi-transparent-over-status-bar-not-working
Could you check this branch? https://github.com/kanytu/android-material-drawer-template/tree/testing_systembar
Edit: and remove your ScrimInsetsFrameLayout.java from the xml
It's the other way round, if you add the ScrimInsetsFrameLayout to your Fragment_navigation_drawer.xml so it looks like
<?xml version="1.0" encoding="utf-8"?>
<com.poliveira.apps.materialtests.ScrimInsetsFrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrimInsetsFrameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:elevation="10dp"
android:fitsSystemWindows="true"
app:insetForeground="#4000">
<android.support.v7.widget.RecyclerView
android:id="@+id/drawerList"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:clickable="true"
android:focusableInTouchMode="true"
android:scrollbars="vertical"
android:focusable="true"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
android:background="@color/myDrawerBackground"/>
</com.poliveira.apps.materialtests.ScrimInsetsFrameLayout>
then you get the desired effect, I still can't get it to work on my project however but going off this branch I should be able to figure out the problem now hopefully.
Notice the changes I made in the commit. You will have to set the android:statusBarColor
in styles.xml to transparent and then change it's color programmatically.
I'm doing that :/ not sure what else I'm missing right now, I feel like I've got everything you changed for this branch, but maybe i added something else that's affecting it.
Not sure exactly what the issue was but I copied your styles v21 over and it's working how it should now. Thanks for your help even though it wasn't an issue with your code :)
Is this possible? My code is as follows but it doesn't seem to work. The content is behind the status bar but I don't get the gray inset, just whatever color I set my status bar to i.e primarycolordark
activity_main.xml
fragment_drawer.xml
MainActivity onCreate method
styles-v21