0

レイアウトスクローラーに問題があります。以下のレイアウトは正常に機能します。水平方向にスクロールするギャラリービューがあり、その下に垂直方向にスクロールするリストビュースクローラーがあります。これで、下部のリストビューを下にスクロールすると、ギャラリービューが上にスクロールして、リストビューがリストビューだけで画面全体を占めるようになります。もう一度上にスクロールすると、ギャラリービューが一番上に戻るはずですが、ギャラリービューを表示/非表示にすることでこれを処理する方法はありますか?

XMLレイアウト:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:background="#c6c6c6"
        android:padding="10dp" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            layout_alignParentLeft="true"
            android:text="Stores"
            android:textSize="20dp" />       
    </RelativeLayout>
    <Gallery
        android:id="@+id/gallery1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
        android:gravity="left"
        android:listSelector="@color/gridviewlistselector"
        android:paddingLeft="10dp"
        android:paddingRight="20dp"
        android:paddingTop="10dp"
        android:spacing="10dp" />
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:background="#c6c6c6"
        android:padding="10dp" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            layout_alignParentLeft="true"
            android:text="Products"
            android:textSize="20dp" />
    </RelativeLayout>
    <GridView
        android:id="@+id/product_grid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/texture"
        android:drawSelectorOnTop="true"
        android:horizontalSpacing="5dp"
        android:listSelector="@color/gridviewlistselector"
        android:numColumns="2"
        android:stretchMode="columnWidth"
        android:verticalSpacing="5dp" />
</LinearLayout>
</LinearLayout>
4

1 に答える 1

0

scrollviewの問題を解決しました。正常に動作します。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:focusableInTouchMode="true" >
<LinearLayout
        android:id="@+id/store"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:background="#c6c6c6"
        android:padding="10dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            layout_alignParentLeft="true"
            android:text="Stores"
            android:textSize="20dp" />
    </RelativeLayout>

    <Gallery
        android:id="@+id/gallery1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
        android:gravity="left"
        android:listSelector="@color/gridviewlistselector"
        android:paddingLeft="10dp"
        android:paddingRight="20dp"
        android:paddingTop="10dp"
        android:spacing="10dp" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:background="#c6c6c6"
        android:padding="10dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            layout_alignParentLeft="true"
            android:text="Products"
            android:textSize="20dp" />
    </RelativeLayout>

    <GridView
        android:id="@+id/product_grid"
        android:layout_width="wrap_content"
        android:layout_height="2000dp"
        android:background="@drawable/texture"
        android:drawSelectorOnTop="true"
        android:horizontalSpacing="5dp"
        android:listSelector="@color/gridviewlistselector"
        android:numColumns="2"
        android:stretchMode="columnWidth"
        android:verticalSpacing="5dp" />
</LinearLayout>

<LinearLayout>
</LinearLayout>

</ScrollView>
于 2012-11-29T19:17:05.670 に答える