【发布时间】:2011-09-15 12:51:59
【问题描述】:
我有一个从 html 检索到的项目列表。
都是头衔。
我正在做的是针对特定事物测试每个标题..
如果有,我想将它添加到小部件中的 TextView。
唯一的问题是,如果它们超过 1 个项目,小部件将无法容纳所有项目。
3.0 之前的小部件不支持列表视图布局。
那么如何在 TextView 上添加每个项目,然后使用下一个按钮显示每个项目以显示下一个 textview?
编辑:
好的,听起来很有道理。 所以在这里我如何检索我的标题...
关于将它们设置为 ArrayList 并在单击 textview 时显示列表中的下一项,您有什么建议?
while(doc == null && retry < 5){
retry++;
try {
doc = Jsoup.connect(site).get();
} catch (IOException e) {
Log.e("Html", "JSoup get retrieved no document", e);
}
}
if(doc != null){
title = doc.select("tr> td.indexList1, tr > td.indexList2");
if(title != null){
// Iterator over those elements
ListIterator<Element> postIt = title.listIterator();
//Loads all the items until there is no .hasNExt()
while (postIt.hasNext()) {
// Add the game text to the ArrayList
Element name = postIt.next();
nameString = name.text();
list.add(new Release(nameString));
那么我将如何使用它最初设置一个文本视图,然后(使用您建议的代码)允许将列表中的下一项加载到文本视图中?
【问题讨论】:
-
"3.0 之前的小部件不支持列表视图布局。"现在呢?