Android には、いくつかのテキスト ボックスを含むヘッダー レイアウトと、高さの異なる要素のグリッドの独自の実装であるビュー グループの 2 つのメイン ビューを持つアクティビティがあります。写真でわかるように:
ビュー内の要素だけでなく、アクティビティ全体をスクロールできるようにしたいと考えています。ListView ではなく、ViewGroup のサブクラスであるため、リストに setHeaderView を使用できませんでした。私はこれを達成することができません:-(
これが私が使用しようとしているコードです:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#E0E0DE"
tools:context=".MainActivity" >
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/layout_action_bar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/background"
android:scaleType="centerCrop"
android:adjustViewBounds="true" />
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/layout_search_view"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
</RelativeLayout>
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/layout_location_info" />
<com.tenea.turipolis.UnequalGridView
android:id="@+id/listPictures"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:columnCount="2"
android:padding="2dp"
android:verticalSpacing="2dp"
android:horizontalSpacing="2dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
ご協力ありがとうございました、