在Android中具有动态列数的表 [英] Table with dynamic number of columns in Android

查看:149
本文介绍了在Android中具有动态列数的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在android中创建一个具有动态列数的表,我知道如何使用LayoutInflator动态添加行,但是如何动态添加列?



谢谢你的时间任何帮助是非常感激的。

解决方案

你不添加列 - 只有行,之后,你可以告诉每个视图多少列需要跨越

  android:layout_span 

定义这个孩子应该跨越多少列。必须是> = 1.

必须是整数值,例如100。

这也可能是对资源的引用(@ [package:] type:name)或主题属性(形式为?[package:] [type:] name )包含此类型的值。

这对应于全局属性资源符号layout_span。

http://developer.android.com/reference/android/widget/TableRow.LayoutParams.html#attr_android:layout_span



最好的Tuts之一: http: //mobile.tutsplus.com/tutorials/android/android-sdk_table-layout/


I want to create a table with dynamic number of columns in android I know how to add rows dynamically using LayoutInflator but how to add columns dynamically?

Thank you for your time any help is highly appreciated.

解决方案

you dont add columns - only rows and after that you can tell every view how many columns need to span

android:layout_span 

Defines how many columns this child should span. Must be >= 1. 

Must be an integer value, such as "100". 

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type. 

This corresponds to the global attribute resource symbol layout_span.

http://developer.android.com/reference/android/widget/TableRow.LayoutParams.html#attr_android:layout_span

one of the best Tuts: http://mobile.tutsplus.com/tutorials/android/android-sdk_table-layout/

这篇关于在Android中具有动态列数的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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