简体   繁体   English

Android:如何创建这样的自定义ListView?

[英]Android: How do I create a custom ListView like this?

How do I make a custom ListView similar to this? 如何制作与此类似的自定义ListView?

列表显示

I want to have a ListView with some US States like Michigan , and upon selection I want to open a new ListView with all the cities in that state. 我想在密歇根州美国拥有一个ListView,选择后我想在该州所有城市中打开一个新的ListView。

There are a bunch of tutorials out there about custom ListView, but I am looking for one similar to what I want to do here. 有很多关于自定义ListView的教程,但是我正在寻找一个与我想在这里做的类似的教程。 I am new to Android programming and I feel its hard to change the code to what I want if the tutorial is very different. 我是Android编程的新手,如果教程非常不同,我很难将代码更改为所需的代码。

Can someone please show me an Example here or link me to a tutorial that is be very helpful? 有人可以在这里给我看一个例子,或将我链接到一个非常有用的教程吗?

Thanks! 谢谢!

You need to define your own layout for the rows in the ListView and use it in your adapter. 您需要为ListView中的行定义自己的布局,并在适配器中使用它。 Please follow this tutorial for more details: http://www.vogella.com/articles/AndroidListView/article.html 请遵循此教程以获取更多详细信息: http : //www.vogella.com/articles/AndroidListView/article.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM