Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android: How to work with CoordinatorLayout and translucent navigation bar?

I have been studying the new google support design library. I am struggling how to make the navigation bar translucent and show content of recyclerView beneath the bar.

I am testing on a 5.1 nexus 5. I used below project as a testing project. sample code from Chris Banes: https://github.com/chrisbanes/cheesesquare

I added below to styles.xml

<item name="android:windowTranslucentNavigation">true</item>

to make the navigation bar translucent.

But, I can't make the CoordinatorLayout and its content, recyclerView, showing beneath the bar.

What I want:

  1. recyclerView shows under navigation bar

  2. quick return is there and when the appbar is hidden, it should not go underneath the translucent status bar. status bar should be able to fully hide the scrolled up part.

like image 368
Jacky Tsang Avatar asked Jun 02 '15 14:06

Jacky Tsang


1 Answers

There's a related issue on Android's issue tracker, however it specifically states API level 21: https://code.google.com/p/android/issues/detail?id=175069

If on your device the android:fitsSystemWindows="true" works, but the only issue is the RecyclerView not showing behind the status-bar, try setting

android:clipToPadding="false"
android:clipChildren="false"

On the RecyclerView or maybe one of its parents

like image 149
marmor Avatar answered Nov 14 '22 09:11

marmor