Expandable Height GridView inside scrollview

*爱你&永不变心* 提交于 2019-12-20 00:20:12

问题


i am using Expandableheightgrideview inside Scroll view,

my problem is when i try to add content in gridview, the content is not expand properly, its displaying 2 scroll bar when its height is exist(its suppose to be an one common scroll bar for entire page).Bottom of the content is hide to view bottom content in gride view need to scroll down.

i used exGridView.setExpanded(true); but no luck

    <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="25dp"
    android:background="@color/transparent"
    android:fillViewport="true" >

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

        <com.ExpandableHeightGridView
            android:id="@+id/result_list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:horizontalSpacing="2dp"
            android:isScrollContainer="false"
            android:numColumns="1"
            android:stretchMode="columnWidth"
            android:verticalSpacing="2dp" >
        </com.ExpandableHeightGridView>

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

            <LinearLayout
                android:id="@+id/start_task_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:layout_gravity="right">

                <Button
                    android:id="@+id/homeBtn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="0dip"
                    android:text="Home"
                    android:textSize="12dip" />
            </LinearLayout>

        </LinearLayout>
    </LinearLayout>

</ScrollView>

回答1:


The Answer is here Problems with GridView inside ScrollView in android

I used ExpandableHeightGridView.java of gitHub and works https://gist.github.com/sakurabird/6868765



来源:https://stackoverflow.com/questions/19242001/expandable-height-gridview-inside-scrollview

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