Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CollapsingToolbarLayout not working properly

Update: this happens on Android 5.0 but it works just fine on 5.1. I filed this issue (https://code.google.com/p/android/issues/detail?id=175240) and it looks like it's gonna be included in the next release of the library


so I've been playing with the new Design Support Library and I've run into some issues. I think I've solved most of them, but I can't get this to work. Actually, not even the provided example is working properly on my phone.

The problem is that when the toolbar is expanded, the icons are way too high. And when collapsed, they are simply gone. See screenshots.

I'm trying this on a Moto X running 5.0. I know this happens in more devices, but it actually works on some of them. Is this happening to you? Any known workaround?

arrow and contextual menu are almost out of the screenand they are gone here

like image 1000
aows Avatar asked May 31 '15 18:05

aows


2 Answers

Fixed on

com.android.support:design:22.2.1
like image 200
Arade Avatar answered Sep 21 '22 14:09

Arade


I found this phenomenon will be in the android 5.0 and above

This is my way to solve:delete "android:fitsSystemWindows="true"" in android.support.design.widget.CoordinatorLayout.

Like this :

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/detail_backdrop_height"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
like image 44
M星空 Avatar answered Sep 23 '22 14:09

M星空