Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 折叠工具栏布局中的工具栏未固定_Android_Layout_Android Design Library - Fatal编程技术网

Android 折叠工具栏布局中的工具栏未固定

Android 折叠工具栏布局中的工具栏未固定,android,layout,android-design-library,Android,Layout,Android Design Library,编辑:更新了tablet gfycat链接 我的手机布局有问题。尽管我在工具栏上设置了app:layout\u collapseMode=“pin”,但它会从屏幕上直接滚动,此外,经典的“幻灯片”运动似乎也被禁用 电话布局: 平板电脑布局: 这里是由细节活动和细节片段膨胀的布局 movie_detail.xml: <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.andr

编辑:更新了tablet gfycat链接

我的手机布局有问题。尽管我在工具栏上设置了app:layout\u collapseMode=“pin”,但它会从屏幕上直接滚动,此外,经典的“幻灯片”运动似乎也被禁用

电话布局:

平板电脑布局:

这里是由细节活动和细节片段膨胀的布局

movie_detail.xml:

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.example.bunny.popularmoviesapp.MovieDetailActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:fitsSystemWindows="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways">

            <!--alpha here to help make text readable over image-->
            <ImageView
                android:id="@+id/backdrop_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:alpha="0.6"
                app:layout_collapseMode="parallax"
                android:adjustViewBounds="true"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/detail_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>

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

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/movie_detail"
                style="?android:attr/textAppearanceLarge"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:padding="16dp"
                android:textIsSelectable="true"
                tools:context="com.example.bunny.popularmoviesapp.MovieDetailFragment" />

            <TextView
                android:id="@+id/overview_text"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="@dimen/text_margin"
                android:layout_below="@id/movie_detail" />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

用这些标签替换AppBarLayout和CollingToolbarLayout打开标签

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/app_bar_height"
    android:fitsSystemWindows="true"
    android:theme="@style/AppTheme.AppBarOverlay">

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

这解决了我的问题。非常感谢。我将深入研究滚动标志和fitsSystemWindows。