将字符串转换的TextView? [英] Converting string into TextView?
本文介绍了将字符串转换的TextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
看一看这个code:
ArrayList<Object> row = data.get(position);
TextView idText = new TextView(this);
idText.setText(row.get(0).toString());
tableRow.addView(idText);
TextView storeText = new TextView(this);
idText.setText(row.get(1).toString());
tableRow.addView(storeText);
TextView maggiText = new TextView(this);
idText.setText(row.get(2).toString());
tableRow.addView(maggiText);
我必须手动创建一个的TextView
,将其设置为某些字符串,然后把它传递。有没有通过,我可以直接把这个字符串排可在为
循环放?一个办法
I have to manually create a TextView
, set it to some string and then pass it. Is there a way by which I can directly pass the string to row that can be put in a for
loop?
我要寻找这种方法的可扩展性问题。
I am looking for this approach for scalability issues.
推荐答案
///你没有错,而复制粘贴
///you did mistake while copy paste
// idText使用在所有的电视
//idText using in all Tv
让做如下
TextView idText = new TextView(this);
idText.setText(row.get(0).toString());
tableRow.addView(idText);
TextView storeText = new TextView(this);
storeText.setText(row.get(1).toString());
tableRow.addView(storeText);
TextView maggiText = new TextView(this);
maggiText.setText(row.get(2).toString());
tableRow.addView(maggiText);
这篇关于将字符串转换的TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文