我发现了一个类似的问题Gridlayout + ScrollView.我尝试了这种方法,但它没有用.
它会删除许多表(因为它应该显示从1到20的所有表).
这是xml文件
<?xml version="1.0" enCoding="utf-8"?><FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" > <ScrollVIEw androID:layout_wIDth="match_parent" androID:layout_height="match_parent" > <linearLayout androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_gravity="center_horizontal" androID:padding="16dp" > <androID.support.v7.Widget.GrIDLayout androID:ID="@+ID/table_mapGrID" androID:layout_wIDth="250dp" androID:layout_height="wrap_content" /> </linearLayout> </ScrollVIEw> <include layout="@layout/cell_List_loading" /> <TextVIEw androID:ID="@+ID/table_errorVIEw" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_gravity="center_vertical" androID:layout_marginleft="20dp" androID:text="@string/message_error_connection" androID:visibility="invisible" /></FrameLayout>
我希望显示动态内容,改变列和行的数量,可能在表之间有空格.
我已经完成了,但问题是当GrIDLayout的宽度变得大于其容器的宽度时,我想用水平滚动来解决它,但它似乎不起作用……
有什么建议吗?
解决方法 好吧,我找到了解决方案似乎AndroID ScrollVIEw作为VerticalScrollVIEw工作,只有那个(名称不像HorizontalScrollVIEw那么直观).
因此,要使某些内容可以垂直和水平滚动,您需要在HorizontalScrollVIEw中嵌套(垂直)ScrollVIEw,或者反过来,就像这样
<ScrollVIEw androID:layout_wIDth="match_parent" androID:layout_height="wrap_content"> <horizontalscrollview androID:layout_wIDth="wrap_content" androID:layout_height="match_parent"> <!-- Your content here --> </horizontalscrollview></ScrollVIEw>总结
以上是内存溢出为你收集整理的GridLayout的Android,水平和垂直滚动全部内容,希望文章能够帮你解决GridLayout的Android,水平和垂直滚动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)