3
編輯:更新了平板電腦gfycat鏈接。摺疊工具欄中的工具欄佈局不被固定
我的手機佈局有問題。即使我在我的工具欄上設置了app:layout_collapseMode =「pin」,它也會立即滾動屏幕,另外,傳統的「幻燈片」動作也會被禁用。
電話佈局: https://gfycat.com/EnviousPaleFlicker
平板佈局: https://gfycat.com/QueasyPowerlessGrayfox
這裏是佈局由細節活性和細節片段都膨脹。
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>
這個固定我的問題。謝謝!我將深入研究滾動標誌和適合SystemWindows。 –