Android中的文本视图循环
我想在模拟器中获得所有路由的描述。我在模拟器中只得到一个描述,但在日志猫中我得到了所有的描述Android中的文本视图循环,android,textview,Android,Textview,我想在模拟器中获得所有路由的描述。我在模拟器中只得到一个描述,但在日志猫中我得到了所有的描述 for (Route route : routes) { text1Status.setText(route.getDescription()); Log.d(TAG, route.getDescription()); } thnaks这是因为您使用的是.setText()方法,它覆盖了您可能获得的所有以前的内容。这就是为什么你觉得你只看到了一个(可能
for (Route route : routes) {
text1Status.setText(route.getDescription());
Log.d(TAG, route.getDescription());
}
thnaks这是因为您使用的是
.setText()
方法,它覆盖了您可能获得的所有以前的内容。这就是为什么你觉得你只看到了一个(可能是最后一个)。尝试改用.append()
。使用TextView的append方法,类似这样
for (Route route : routes) {
text1Status.append(route.getDescription() + "\n");
Log.d(TAG, route.getDescription());
}
我希望你能为我服务