私のアプリケーションでは、Expandable Height GridView(EHGV)を使用していくつかのアイテムを表示しています。 EHGVの上にはページャレイアウトがあり、ページャレイアウトとEHGVの両方がスクロールビューの内側にあります。私の問題は、ページを下にスクロールするときに画面の向きを変更した後、ページが内容の後にスクロールされます(添付されたイメージに示されているように)。内容の後にScrollviewがスクロールします
ページの初回起動時には、スクロールが正常に動作しますが、オリエンテーションの後、より多くをスクロールします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の内側にすべきではない理由を私はExpandableHeightGridViewの代わりに、GridViewコントロール – Rasel
内側にあるべきではありませんだから、私はあなたのExpandableHeightGridViewの実装が良くないと思う – Phoenix
を使用していますscrollview – Rasel