Android TableLayout数据列表的回显清空实现思路及代码

Android TableLayout数据列表的回显清空实现思路及代码,第1张

概述复制代码代码如下://数据列表的回显publicvoidshujuList(){List<Customer>customerList=dao.findALL();TableLayouttl=(TableLayout)findViewById(R.id.tlLayout);Log.i(\">>>\",String.valueOf(tl.ge 复制代码 代码如下:
//数据列表的回显
public voID shujuList(){
List<Customer> customerList = dao.findALL();
tableLayout tl = (tableLayout) findVIEwByID(R.ID.tlLayout);
Log.i(">>>",String.valueOf(tl.getChildCount()));
int j = tl.getChildCount();
if(j>1){
/*for(int i=0;i<j;i++){
tl.removeVIEw(tl.getChildAt(j-i));//必须从后面减去子元素
}*/
for(int i=j;i>0;i--){
tl.removeVIEw(tl.getChildAt(i));//必须从后面减去子元素
}
}
tableRow row = null;
for(Customer c : customerList){
row = new tableRow(this);
//ID
TextVIEw tvID = new TextVIEw(this);
tvID.setText(c.ID + "");
row.addVIEw(tvID);
//name
TextVIEw tvname = new TextVIEw(this);
tvname.setText(c.name);
row.addVIEw(tvname);
//age
TextVIEw tvAge = new TextVIEw(this);
tvAge.setText(c.teleNumber + "");
row.addVIEw(tvAge);
tl.addVIEw(row);
}
}
总结

以上是内存溢出为你收集整理的Android TableLayout数据列表的回显清空实现思路及代码全部内容,希望文章能够帮你解决Android TableLayout数据列表的回显清空实现思路及代码所遇到的程序开发问题。

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

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

原文地址:https://54852.com/web/1141588.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存