Java Scrollview没有';t使用2个listview滚动

Java Scrollview没有';t使用2个listview滚动,java,android,listview,android-studio,scrollview,Java,Android,Listview,Android Studio,Scrollview,我搜索了很多关于scrollview的主题,但没有人能解决我的问题:/ 如果有人能帮我:) 当我从服务器发出请求时,每个listview都会打印一些人 通常,当我向下滚动列表时,会出现第二个列表,但不会出现 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/

我搜索了很多关于scrollview的主题,但没有人能解决我的问题:/ 如果有人能帮我:) 当我从服务器发出请求时,每个listview都会打印一些人 通常,当我向下滚动列表时,会出现第二个列表,但不会出现

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/selector_for_background_white"
    android:orientation="vertical">

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/selector_for_background_white"
        android:fillViewport="true">

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

            <LinearLayout
                android:id="@+id/layoutScrollResult"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:background="@drawable/selector_for_background_white">

                    <LinearLayout
                        android:id="@+id/layout2"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:orientation="horizontal">

                        <com.whask.whask.utils.font.FontTextView
                            android:id="@+id/text_hot"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_gravity="center"
                            android:layout_marginLeft="10dp"
                            android:layout_marginStart="10dp"
                            android:background="@android:color/transparent"
                            android:text="5 HOT"
                            android:textSize="@dimen/abc_text_size_medium_material"
                            app:font="Neo-Sans-Std-Medium.otf"/>
                    </LinearLayout>


                    <ListView
                        android:id="@+id/result_whask_listview_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/layout2">
                    </ListView>

                    <LinearLayout
                        android:id="@+id/layout3"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:layout_below="@+id/result_whask_listview_view"
                        android:orientation="horizontal">

                        <com.whask.whask.utils.font.FontTextView
                            android:id="@+id/text_not"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_gravity="center"
                            android:layout_marginLeft="10dp"
                            android:layout_marginStart="10dp"
                            android:background="@android:color/transparent"
                            android:text="2 NOT"
                            android:textSize="@dimen/abc_text_size_medium_material"
                            app:font="Neo-Sans-Std-Medium.otf"/>
                    </LinearLayout>

                    <ListView
                        android:id="@+id/result_whask_listview_view_no"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/layout3"
                        android:background="@color/my_whask_white_color">
                    </ListView>

                </RelativeLayout>

            </LinearLayout>

        </LinearLayout>

    </ScrollView>

</LinearLayout>


不要在
滚动视图中使用
列表视图
ListView
本身有一个滚动属性,您不必使用另一个
ScrollView
使其滚动。请改用
线性布局。

Listview有自己的滚动属性,所以不要在scrollview中使用。。。
如果您想在Scrollview中滚动listview,而不只是这样做,请多谢

 ListView result_whask_listview_view;
 result_whask_listview_view = (ListView)findViewById(R.id.result_whask_listview_view);

 result_whask_listview_view.setOnTouchListener(new ListView.OnTouchListener() {
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        int action = event.getAction();
                        switch (action) {
                            case MotionEvent.ACTION_DOWN:
                                // Disallow ScrollView to intercept touch events.
                                v.getParent().requestDisallowInterceptTouchEvent(true);
                                break;

                            case MotionEvent.ACTION_UP:
                                // Allow ScrollView to intercept touch events.
                                v.getParent().requestDisallowInterceptTouchEvent(false);
                                break;
                        }

                        // Handle ListView touch events.
                        v.onTouchEvent(event);
                        return true;
                    }
                });
这样,您可以在scrollview中滚动listview


希望它能帮助您:)

您不应该将scrollview与listview一起使用,因为listview有自己的滚动功能。不要使用listview,而是在线性或框架布局中对项目进行充气。通过这种方式,您可以很容易地实现换行内容功能,因为listview无法正常使用换行内容。是否要在scrollview中滚动listview@Mavrick RMXI如果我不使用ScrollView,我的2 FontTextView将不会滚动,我的第二个listview保留在底部,我看不到这些元素,我需要我的FontTextView也滚动@Vivekmisharai我不是说你不应该使用ScrollView。我是说不要在scrollview中使用listview。是的,这就是我想要的,那么我屏幕底部的listview可以替换第一个listview@Rushabh042