workaround CollapsingToolbarLayout issue in support lib
Fix from https://issuetracker.google.com/issues/64065383#comment12
This commit is contained in:
parent
a835b5b594
commit
6ed3c744a5
|
@ -0,0 +1,30 @@
|
|||
package android.support.design.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.WindowInsetsCompat;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class FixedCollapsingToolbarLayout extends CollapsingToolbarLayout {
|
||||
|
||||
public FixedCollapsingToolbarLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public FixedCollapsingToolbarLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// During the super call to onMeasure(), we'll save a copy of mLastInsets,
|
||||
// consume the insets of mLastInsets so the super call has no insets to work with,
|
||||
// then re-assign mLastInsets to what it was before the super call.
|
||||
WindowInsetsCompat oldInsets = mLastInsets;
|
||||
if (mLastInsets != null) {
|
||||
mLastInsets = mLastInsets.consumeSystemWindowInsets();
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
mLastInsets = oldInsets;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
android:fitsSystemWindows="true"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
<android.support.design.widget.FixedCollapsingToolbarLayout
|
||||
android:id="@+id/collapsing_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -163,7 +163,7 @@
|
|||
app:layout_collapseMode="pin"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
</android.support.design.widget.FixedCollapsingToolbarLayout>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue