you can see gridview in the image which is not wrapping whole nestedscrollview夥計們請幫我我在這個代碼中被困住了,我需要一個崩潰的工具欄佈局,我也成功了,但是嵌套的scrollview裏面的gridview沒有包裝nestedscrollview的總空間,我嘗試了很多方式但失敗。嵌套滾動視圖gridview的大小問題
這是在幫我崩潰工具欄,在那裏我得到gridview的問題XML,
<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.patelsanket.myalbum.activities.AlbumImageDisplayActivity">
<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">
<ImageView
android:id="@+id/headerImage1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/shows_header_image"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
android:src="@drawable/cod" />
<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/AppTheme.PopupOverlay" />
</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">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<GridView
android:id="@+id/album_image_grid_view"
android:layout_width="match_parent"
android:layout_height="550dip"
android:choiceMode="multipleChoice"
android:horizontalSpacing="0.5dp"
android:numColumns="2"
android:paddingBottom="20dip" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_add"
app:backgroundTint="#009688"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end|right" />
</android.support.design.widget.CoordinatorLayout>
對於未來的推薦人,它的工作原理,這應該被標記爲答案! –
是的,這是一個正確的方法。但那些沒有使用recyclerview的人,那麼我的回答也會很好。 –