android多列布局筛选,android - 如何在Android中启用具有多列以适合水平滚动视图的表布局? - 堆栈内存溢出...

我需要在应用程序中创建表布局。 但是,该表包含许多不能分开的列。 因此,我想将表格布局放在水平scrollview中。

这是我的xml代码。

main_activity.xml

android:layout_width="match_parent"

android:layout_height="match_parent"

android:id="@+id/parent_layout">

android:id="@+id/linearid"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_weight="1"

android:gravity="center"

android:orientation="vertical">

android:id="@+id/name"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="#FFA500"

android:gravity="center"

android:paddingVertical="10dp"

android:text="@string/send"

android:textColor="#ffffff"

android:textSize="30sp"

android:textStyle="bold" />

android:layout_width="wrap_content"

android:layout_height="match_parent"

android:layout_alignParentTop="true"

android:fillViewport="true"

android:measureAllChildren="false"

android:scrollbars="none">

android:id="@+id/myRecycle"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_centerVertical="true"

android:layout_centerHorizontal="true"

android:layout_alignLeft="@+id/linearid"

android:layout_marginHorizontal="20dp"

android:layout_marginLeft="30dp" />

Recyclerview xml由表格布局组成

android:layout_height="wrap_content"

android:layout_alignParentTop="true"

android:fillViewport="true"

android:measureAllChildren="false"

android:scrollbars="none"

xmlns:android="http://schemas.android.com/apk/res/android">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal"

android:gravity="center"

>

android:background="@drawable/border"

android:layout_width="match_parent"

android:stretchColumns="2"

android:layout_height="match_parent"

>

android:background="@drawable/border"

>

android:id="@+id/tnameresult"

android:layout_height="wrap_content"

android:layout_width="0dip"

android:layout_weight="1"

android:text="@string/dem"

android:background="@drawable/border"

android:padding="3dip" />

android:id="@+id/tcompresult"

android:layout_height="wrap_content"

android:layout_width="0dip"

android:layout_weight="1"

android:text="@string/dem"

android:background="@drawable/border"

android:padding="3dip" />

这是我的表格布局显示,列的宽度和高度不会自动自动拉伸。 有人可以教我如何做吗? 谢谢 :)

51caf0336d43fbe9942a7686380e4b3b.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值