滚动型内高度可扩展的GridView [英] Expandable Height GridView inside scrollview

查看:256
本文介绍了滚动型内高度可扩展的GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Expandableheightgrideview滚动视图内,

我的问题是,当我试图在GridView中添加内容,内容是不正确的扩展,其2显示滚动条时,它的高度是存在的(其假设是对整个网页的一个共同的滚动条).Bottom内容是隐藏,以查看gride视图底部的内容需要向下滚动。

我用 exGridView.setExpanded(真); ,但没有运气

 <?XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_marginTop =25dp
    机器人:背景=@色/透明
    机器人:fillViewport =真正的>    <的LinearLayout
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直>        < com.ExpandableHeightGridView
            机器人:ID =@ + ID / result_list
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:比重=中心
            机器人:horizo​​ntalSpacing =2DP
            机器人:isScrollContainer =假
            机器人:为numColumns =1
            机器人:stretchMode =columnWidth时
            机器人:verticalSpacing =2DP>
        < /com.ExpandableHeightGridView>        <的LinearLayout
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=横向>            <的LinearLayout
                机器人:ID =@ + ID / start_task_layout
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT                机器人:layout_gravity =右>                <按钮
                    机器人:ID =@ + ID / homeBtn
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginRight =0dip
                    机器人:文字=家
                    机器人:TEXTSIZE =12dip/>
            < / LinearLayout中>        < / LinearLayout中>
    < / LinearLayout中>< /滚动型>


解决方案

答案就在这里<一个href=\"http://stackoverflow.com/questions/21264951/problems-with-gridview-inside-scrollview-in-android\">Problems在Android的里面滚动型的GridView

我用的GitHub和作品ExpandableHeightGridView.java
https://gist.github.com/sakurabird/6868765

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>

解决方案

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

这篇关于滚动型内高度可扩展的GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆