Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使我的滚动视图在具有可扩展列表视图的情况下工作? 我在滚动视图中有一个可扩展列表视图。以下是我的布局: 这里我使用的是一个名为Gabriel GridView的**自定义GridView****我的滚动视图无法工作,因为其中包含我的列表视图。我怎样才能让它工作**_Android_Scrollview_Expandablelistview - Fatal编程技术网

Android 如何使我的滚动视图在具有可扩展列表视图的情况下工作? 我在滚动视图中有一个可扩展列表视图。以下是我的布局: 这里我使用的是一个名为Gabriel GridView的**自定义GridView****我的滚动视图无法工作,因为其中包含我的列表视图。我怎样才能让它工作**

Android 如何使我的滚动视图在具有可扩展列表视图的情况下工作? 我在滚动视图中有一个可扩展列表视图。以下是我的布局: 这里我使用的是一个名为Gabriel GridView的**自定义GridView****我的滚动视图无法工作,因为其中包含我的列表视图。我怎样才能让它工作**,android,scrollview,expandablelistview,Android,Scrollview,Expandablelistview,在另一个可滚动视图中使用可滚动视图不是一个好选择。但是,如果您希望在不考虑使用嵌套可滚动视图的警告的情况下执行此操作。然后创建自己的自定义非ScrollableExpandableListView和自定义gridview上的包装器非ScrollableGabrielGridView。然后在两个组件上重写onMeasure()方法,如下所示: I am having Expandable List View inside a scroll view.Here is my layou

在另一个可滚动视图中使用可滚动视图不是一个好选择。但是,如果您希望在不考虑使用嵌套可滚动视图的警告的情况下执行此操作。然后创建自己的自定义非ScrollableExpandableListView和自定义gridview上的包装器非ScrollableGabrielGridView。然后在两个组件上重写
onMeasure()
方法,如下所示:

        I am having Expandable List View inside a scroll view.Here is my layout :

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

          <RelativeLayout 
                    android:id="@+id/parentLayout"
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent">

                    <RelativeLayout
                        android:id="@+id/first_layout"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:paddingTop="5dp" >

                        <com.tfe.view.GabrielGridView
                            android:id="@+id/sample_grid"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="15dp"
                            android:columnWidth="20dp"
                            android:horizontalSpacing="5dp"
                            android:numColumns="auto_fit"
                            android:stretchMode="columnWidth"
                            android:verticalSpacing="5dp" >

                        </com.tfe.view.GabrielGridView>

                    </RelativeLayout>

                    <RelativeLayout

                        android:id="@+id/secondLayout"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/first_layout"
                        android:paddingBottom="10dp" >


                            <TextView
                                android:id="@+id/textView1"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginRight="24dp" />

                        </RelativeLayout>




                    <RelativeLayout
                        android:id="@+id/third_Layout"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_below="@id/second_Layout" >

                        <View
                            android:id="@+id/divider"
                            android:layout_width="fill_parent"
                            android:layout_height="3dp"/>

                        <ExpandableListView
                            android:id="@+id/expandableListViewLayout"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"
                            android:cacheColorHint="#00000000"
                            android:layout_margin="10dp"
                            android:layout_marginTop="20dp"
                            android:footerDividersEnabled="false"
                            android:groupIndicator="@null" />

                    </RelativeLayout>

                </RelativeLayout>

    </ScrollView>

    Here I am using a **custom GridView** called Gabriel GridView. **My scroll view doesn't work because of my List View inside it. How can I make it work?**

同样,这是一个错误的选择

您不应该将
列表视图
添加到另一个
滚动视图
。你应该寻找其他方法来解决这个问题。
@Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        // Do not use the highest two bits of Integer.MAX_VALUE because they are
        // reserved for the MeasureSpec mode
        int heightSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, heightSpec);
        getLayoutParams().height = getMeasuredHeight();
    }