Android 折叠工具栏布局/工具栏边距错误

Android 折叠工具栏布局/工具栏边距错误,android,toolbar,android-collapsingtoolbarlayout,Android,Toolbar,Android Collapsingtoolbarlayout,我想在我的应用程序中使用与@chrisbanses cheesesquare()类似的布局 Nexus 5,6上的一切都很好。但当你在三星S6等其他设备上测试它时,索尼Z3 Compact工具栏上的按钮是看不见的 <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="

我想在我的应用程序中使用与@chrisbanses cheesesquare()类似的布局

Nexus 5,6上的一切都很好。但当你在三星S6等其他设备上测试它时,索尼Z3 Compact工具栏上的按钮是看不见的

<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">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <ImageView
            android:id="@+id/backdrop"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            android:scaleType="centerCrop"
            android:src="@drawable/default_vehicle"
            app:layout_collapseMode="parallax" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.CollapsingToolbarLayout>


这是我的布局。我找不到办法解决这个问题。你可以试着在手机上运行Cheesesquare,就像使用5.0.2 Android的三星S一样。我还测试了索尼的设备。相同的。Nexus的电话没问题

你知道怎么解决这个问题吗


我正在使用com.android.support:design:22.2.0(最新版本)

好的。我已经确认了。这是设计支持库22.2.0中的错误。 更多信息:

如果你知道谷歌发布补丁之前的任何解决方法,我会非常感谢

工具栏和缺少按钮问题(位置错误)有一个解决方法

编辑:
谷歌更新了支持库。此错误已在22.2.1版本中修复。只要更新支持库并使用最新版本,一切都会好起来。

这只适用于三星。如果你检查其他手机,它将无法工作-例如索尼Z3,OnePlus一。只为一个用户创建修复很容易。好消息是这个问题已经被谷歌解决了,我们很快就会看到更新的支持库。这是可行的,但问题是它会清除我工具栏中的所有菜单项,就像导航抽屉的图标一样。有什么建议吗?
if ("samsung".equals(Build.MANUFACTURER) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Toolbar toolbar = getToolbar();
        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
        lp.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -47, getResources().getDisplayMetrics());
        toolbar.setLayoutParams(lp);
    }
if ("samsung".equals(Build.MANUFACTURER) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Toolbar toolbar = getToolbar();
        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
        lp.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -47, getResources().getDisplayMetrics());
        toolbar.setLayoutParams(lp);
    }