最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android TableLayout數(shù)據(jù)列表的回顯清空實現(xiàn)思路及代碼

 更新時間:2013年04月26日 16:35:10   作者:  
數(shù)據(jù)列表的回顯必須從后面減去子元素同時必須從后面減去子元素,感興趣的朋友可以看下具體的實現(xiàn)代碼,希望對你學(xué)習(xí)Android TableLayout有所幫助
復(fù)制代碼 代碼如下:

//數(shù)據(jù)列表的回顯
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);
}
}

相關(guān)文章

最新評論

东山县| 浦北县| 汽车| 宁陵县| 英吉沙县| 正阳县| 金川县| 星座| 磴口县| 孝义市| 特克斯县| 社会| 双桥区| 司法| 长治市| 鄂州市| 佛学| 通榆县| 鹤岗市| 彰武县| 台中市| 上林县| 芮城县| 无锡市| 永昌县| 石狮市| 丰城市| 开平市| 承德市| 叶城县| 封丘县| 卓尼县| 扶风县| 峨边| 兰溪市| 囊谦县| 巴林左旗| 临沧市| 黔西| 马关县| 茶陵县|