Android列表视图不会全部扩展

时间:2015-06-04 02:55:58

标签: android listview

这是我的设计:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

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

 <ListView
            android:id="@+id/listView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:divider="#88888888"
            android:dividerHeight="0dp" />
</LinearLayout>
</ScrollView>

我的问题是listview无法展开所有项目,我想查看listview中的所有项目。

1 个答案:

答案 0 :(得分:0)

在Java代码中使用它

mListView.setOnTouchListener(new View.OnTouchListener() {
        // Setting on Touch Listener for handling the touch inside
        // ScrollView
        @SuppressLint("ClickableViewAccessibility")
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // Disallow the touch request for parent scroll on touch of
            // child view
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });