When I was trying out the new Design Support Library (compile 'com.android.support:design:22.2.0')
and using the Toolbar to replace the Actionbar.
A problem occurs on Android 5.0 devices where the Toolbar goes under the system Status Bar and leaves a empty space on top of the main layout as the following picture shows.
To fix this, we add an attribute to the Layout of this activity:
android:fitsSystemWindows="true"
This attribute is boolean internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows. Will only take effect if this view is in a non-embedded activity.
The fitsSystemWindows attribute makes your Layout View fit to the edges of the action bar and navigation bar (instead of going under them).
Then the problem is fixed and the display is exactly what we want it to be.
No comments:
Post a Comment