简体   繁体   中英

Scrollview is not scrolling inside a custom view for a listview

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"

    android:layout_height="140dp"
    android:background="@color/colorPrimary">


    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_below="@+id/image"
        android:layout_centerHorizontal="true"
        android:fillViewport="true"
        android:scrollbars="vertical"

        >


        <TextView
            android:id="@+id/prayerMessage"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:text="please God forgive me for all my mistakes i have ever done in my life please God forgive me for all my mistakes i have ever"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="#ffffff"

            />

    </ScrollView>
</RelativeLayout>

this is my xml file and scrollview is not scrolling.

Can anyone please suggest a solution?

I am using a custom view for a listview using a custom adapter

It is not recommended to use multiple Scrollable view inside one another. You are using ScrollView inside List View and that you should not do. It is a bad practice.

Instead you use Dynamic Layout Addition via view.add()

Height of your scroll view is 200dp. Since 200dp fits in the screen there is nothing to scroll. You can try setting the height to

android:layout_height="match_parent"

or

android:layout_height="wrap_content"

if height of your UI items are larger then screen size.

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