
//数据列表的回显
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数据列表的回显清空实现思路及代码所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)