在一个多活动的ListView [英] multiple listview in one activity

查看:187
本文介绍了在一个多活动的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果我不能讲好英语,
如何在一个活动的多个列表视图扩展ListActivity,如

Sorry if I can not speak good English, how have multiple Listview in one activity that extends ListActivity such as

private List<Tour> tours;
ArrayAdapter<Tour> adapter = new ArrayAdapter<Tour>(this, 
                    android.R.layout.simple_list_item_1, tours);
setListAdapter(adapter);

这code是在活动一列表视图的ListView控件的ID是@android:ID /清单,但我有两个或两个以上Lisview在一个活动
请指引我

this code is for one Listview in activity that Listview's id is @android:id/list but i have two or more Lisview in one activity Please guide me

推荐答案

您应该延伸活动而不是 ListActivity 在code。
并在活动的布局xml文件,你应该采取两个不同的ID为两个列表视图。

You should extends Activity instead of ListActivity in your code. And in your activity's layout xml file you should take two different id for that two list view.

请参见下面的参考链接了解更多详情...

See below reference links for more details...

的http:// WWW。coderzheaven.com / 2012/03/02 /一个简单的布局与 - 两列表视图/

<一个href=\"http://stackoverflow.com/questions/2577021/multiple-listviews-in-single-activity-in-android\">Multiple在Android的一个活动列表视图?

<一个href=\"http://stackoverflow.com/questions/17693578/android-how-to-display-2-listviews-in-one-activity-one-after-the-other\">Android如何在其他后显示于一体的活动一2列表视图

Android how to display 2 listviews in one activity one after the other

这篇关于在一个多活动的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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