国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android TableLayout數據列表的回顯清空實現思路及代碼

2020-04-11 12:27:26
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:

//數據列表的回顯
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);
}
}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 胶州市| 女性| 贵港市| 双城市| 民和| 顺昌县| 鹰潭市| 武夷山市| 汝州市| 东台市| 久治县| 葫芦岛市| 承德市| 邯郸市| 于田县| 靖州| 黑水县| 遂宁市| 大兴区| 广西| 江西省| 扶风县| 鄂州市| 方正县| 潜山县| 宣威市| 会宁县| 确山县| 墨玉县| 岳西县| 合作市| 正定县| 鹤岗市| 阜南县| 江油市| 赤峰市| 郯城县| 甘谷县| 阿坝县| 辉南县| 揭阳市|