【发布时间】:2013-05-08 06:08:10
【问题描述】:
我有一个从数据库中获取字符串并将其放入 ListView 的应用程序。 这是从数据库中获取我的字符串的代码:
public void setLogView(String date){
ArrayAdapter<TextView> adapter = new ArrayAdapter<TextView>(this, android.R.layout.simple_list_item_1);
listView.setAdapter(adapter);
DataBaseMain dataBase = new DataBaseMain(this);
dataBase.open();
String[][] all = dataBase.dayLog(date);
dataBase.close();
if(all == null)
return;
String temporay = "";
for(int j = 0; j < all[0].length; j++){
temporay = "";
for (int i = 0; i < all.length; i++){
TextView text = new TextView(this);
temporay = temporay + " " + all[i][j];
text.setText(temporay);
adapter.add((TextView)text);
}
}
}
似乎我在我的 ListView 中获得了新的 TextView,但文本被弄乱了。
我检查了我的temporay 字符串,很好。
在某个地方把他放在 ListView 中。
logcat 中没有错误或异常。
这是我在我的应用程序 ListView 中得到的我想要的文本。(我想放 picutrue 但我没有足够的重复:
【问题讨论】:
-
你能分享一下你所期待的和你观察到的截图吗
-
我加了你的声望,你可以加个图
-
请添加截图。
-
@CRUSADER。添加了屏幕截图
标签: android android-listview textview