Android的 - ListView中只显示第一个结果 [英] Android - ListView only show the first result

查看:239
本文介绍了Android的 - ListView中只显示第一个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Android应用程序,它与使用Twitter的搜索API进行交互。 逝去的效果很好,只是当我想用一个ListView显示结果,只有第一结果示。

I am working on an android app which interacts with Twitter using their search API. Everythings works well except that when I want to show the result using a ListView, only the first result is shown.

ArrayList<TwitterJSONResults> arrayList = new ArrayList<TwitterJSONResults>(data.getResults().size());
for (int i = 0; i < data.getResults().size(); i++) {
    arrayList.add(data.getResults().get(i));
}

ArrayAdapter<TwitterJSONResults> resultAdapter = new ArrayAdapter<TwitterJSONResults>(
                this, android.R.layout.simple_list_item_1, arrayList);
listview.setAdapter(resultAdapter);
resultAdapter.notifyDataSetChanged();

在code段上面显示我是如何的结果添加到适配器以及该适配器的列表视图,我在做什么错了?

The code snippet above show how I add the results to the adapter and set this adapter to the the listview, What am I doing wrong?

推荐答案

不要把ListView的滚动型内:)

Don't put ListView inside of a ScrollView :)

这篇关于Android的 - ListView中只显示第一个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆