机器人TableLayout编程 [英] Android TableLayout programatically

查看:93
本文介绍了机器人TableLayout编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的机器人的研究与开发。我学会了如何使用XML file.But请帮助我知道该怎么做它来创建用户界面编程,而无需使用XML文件,特别是对超过的LinearLayout

I am new to android developement. I learned how to create UI using XML file.But please help me to know how to do it programmatically without using XML files especially for other than LinearLayout

推荐答案

使用下面的code创建TableLayout

Use the following code to create the TableLayout

TableLayout tbl=new TableLayout(context);

使用下面的创建表行

TableRow tr=new TableRow(context);

添加视图到表行

add View into table row

tr.addView(view);

下面来看可能是一个TextView或EditText上或等..

here view may be a TextView or EditText or ect..

添加表行到TableLayout

add Table Row into TableLayout

tbl.addView(tr);

就像你可以添加更多的表行到表布局。

Like that you can add more table rows into Table Layout.

这篇关于机器人TableLayout编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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