Listview not working inside ScrollView

帅比萌擦擦* 提交于 2019-12-25 09:08:14

问题


I have created a listview inside scrollview, the list have started scrolling but linearlayout below listview does not appears on screen. have used custom adapter to fill list. Below is my code, please any body help me.

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fff"
    android:fillViewport="true"
    >

    <RelativeLayout 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:background="#fff"
        tools:context=".Crew">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="16dp"
                >

                <ListView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/crew_list"
                    android:layout_marginTop="20dp"
                    ></ListView>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_alignParentBottom="true"
                    android:layout_gravity="bottom"
                    >
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="MESSAGE"
                        android:fontFamily="Myriad Pro"
                        android:textSize="15dp"
                        android:textColor="#d0d0d0"
                        android:padding="5dp"
                        />

                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textMultiLine"
                        android:textSize="15dp"
                        android:padding="10dp"
                        android:text=""
                        android:gravity="top|left"
                        android:background="@drawable/textarealayout"
                        android:id="@+id/report_cabin_crew"
                        android:lines="3"/>

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:orientation="horizontal">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center"
                            android:src="@drawable/greybox"/>

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="SEND SMS"
                            android:layout_marginLeft="5dp"
                            android:textColor="#0a3e8d"
                            />

                    </LinearLayout>

                    <Button
                        android:layout_width="match_parent"
                        android:layout_marginTop="8dp"
                        android:layout_height="wrap_content"
                        android:text="SEND MESSAGE"
                        android:textColor="#fff"
                        android:textSize="18dp"
                        android:background="@drawable/buttonlayout"
                        />
                </LinearLayout>


            </LinearLayout>

        </LinearLayout>


    </RelativeLayout>


</ScrollView>

回答1:


You cant have to scrolling layouts inside each other. When organize your layout you would realized that you can achieve the same behavior and look with one of them.



来源:https://stackoverflow.com/questions/41198861/listview-not-working-inside-scrollview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!