简体   繁体   中英

Android ListView not scrolling inside ViewFlipper

I have A LinearLayout with a GridLayout inside. The GridLayout houses an ImageView, Textviews and then a ListView. I have tried all I can to get the ListView to scroll but it doesn't scroll at all. The LinearLayout ( Main One ) Is housed in a ViewFlipper if that changes anything.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:id="@+id/singleClub"
         android:weightSum="1">
    <GridLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="150dp"
            android:id="@+id/mainclub_image"
            android:layout_row="0"
            android:layout_column="0"
            android:scaleType="centerCrop"
            android:focusableInTouchMode="true"/>

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Large Text"
            android:id="@+id/mainclub_name"
            android:layout_row="1"
            android:layout_column="0"
            android:layout_marginRight="10dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Genre"
            android:id="@+id/mainclub_genre"
            android:layout_row="2"
            android:layout_column="0"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Opening Times"
            android:id="@+id/textqView3"
            android:layout_row="3"
            android:layout_column="0"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="Mon 00:00"
            android:id="@+id/mainclub_openingtimes"
            android:layout_row="4"
            android:layout_column="0"/>

        <ScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_row="5"
            android:layout_column="0">
                <ListView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/mainclub_listview"
                    android:choiceMode="multipleChoice"/>
        </ScrollView>
    </GridLayout>
</LinearLayout>

I originally tried it with a Custom Expandable List View which worked but then stopped working later on. Any help would be greatly appreciated.

Remove scrollview outlining ListView and then set the height and width values of list view to match_parent. And Try using a relativelayout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM