0
在我的應用程序中,我使用Expandable Height GridView(EHGV)顯示了一些項目。在EHGV上方有頁面佈局,並且頁面佈局和EHGV都在滾動視圖內。我的問題是在向下滾動頁面時更改屏幕方向後,頁面將滾動到內容之後(如附圖所示)。Scrollview在內容後滾動
網頁時啓動第一次,滾動工作正常,但方向後,滾動視圖獲得更多的滾動。請給我一個解決方案。
這是我的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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<RelativeLayout
android:id="@+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/img_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/big_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:scaleType="centerCrop" />
<com.xyz.xyz.ObservableScrollView
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/pager_layout"
android:layout_width="match_parent"
android:layout_height="200dp"
android:focusable="true"
android:focusableInTouchMode="true">
<android.support.v4.view.ViewPager
android:id="@+id/images_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:listitem="@layout/dashboard_grid_banner_item" />
<LinearLayout
android:id="@+id/image_count"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:background="#00000000"
android:gravity="center"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/pager_layout">
<com.xyz.xyz.ExpandableHeightGridView
android:id="@+id/grid_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="26dp"
android:fadingEdge="none"
android:gravity="center"
android:horizontalSpacing="26dp"
android:listSelector="@android:color/transparent"
android:numColumns="2"
android:overScrollMode="never"
android:scrollbars="none"
android:stretchMode="columnWidth"
android:verticalSpacing="26dp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</com.thoughtripples.mandmdemo.ObservableScrollView>
</RelativeLayout>
<include layout="@layout/gradient_header" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/Theme.AppCompat.Light.DarkActionBar"
app:theme="@style/Toolbar" />
</android.support.design.widget.CoordinatorLayout>
滾動視圖不應該是裏面另一個滾動view.ie gridview的shouldnot在裏面滾動型 – Rasel
這就是爲什麼我使用ExpandableHeightGridView代替GridView控件 – Phoenix
所以,我認爲你的ExpandableHeightGridView實現不好 – Rasel