GridLayout的Android,水平和垂直滚动

GridLayout的Android,水平和垂直滚动,第1张

概述我无法让GridLayout水平滚动. 我发现了一个类似的问题Gridlayout + ScrollView.我尝试了这种方法,但它没有用. 它会删除许多表(因为它应该显示从1到20的所有表). 这是xml文件 <?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/ 我无法让GrIDLayout水平滚动.

我发现了一个类似的问题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工作,只有那个(名称不像Horizo​​ntalScrollVIEw那么直观).

因此,要使某些内容可以垂直和水平滚动,您需要在Horizo​​ntalScrollVIEw中嵌套(垂直)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,水平和垂直滚动所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1143667.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存