我正在使用工具欄和一個以上的Textview文本,但是當我滾動我試圖隱藏我的工具欄,但它不隱藏,以下是我的XML代碼任何人都可以幫助我,這個,在此先感謝..爲什麼工具欄在滾動時沒有隱藏?
<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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical"
android:paddingTop="24dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Product Name:"
android:layout_marginLeft="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/desc_prodname"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:text="@string/cheese_ipsum"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Brand:"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/desc_brandnm"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:text="@string/cheese_ipsum"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Description:"
android:layout_marginLeft="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/desc_description"
android:layout_marginLeft="5dp"
android:text="@string/cheese_ipsum"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Price:"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/desc_price"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:text="@string/cheese_ipsum"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Category:"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/desc_catname"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Subcategory:"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/desc_subcatname"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<!--<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="@id/appbar"
app:layout_anchorGravity="bottom|right|end"
android:src="@drawable/ic_discuss"
android:layout_margin="@dimen/fab_margin"
android:clickable="true"/>-->
</android.support.design.widget.CoordinatorLayout>
scrollview canb只託管一個孩子 – albert