Android ListView示例教程

这篇教程介绍了Android ListView的基础知识,包括其定义、如何使用适配器填充数据,以及处理点击事件的方法。示例项目展示了如何创建一个简单的ListView,并在选择列表项时启动新活动。
摘要由CSDN通过智能技术生成

We will learn how to create a simple Android ListView and launch a new activity on selecting a single list item.

我们将学习如何创建一个简单的Android ListView并在选择单个列表项时启动新的活动。

什么是Android ListView? (What is Android ListView?)

Android ListView is a view which groups several items and display them in vertical scrollable list. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database. It’s one of the basic and most used UI components of android. The most common usages include displaying data in the form of a vertical scrolling list.

Android ListView是将多个项目分组并在垂直滚动列表中显示的视图。 列表项是使用适配器从列表或数据库等源中自动提取内容的适配器自动插入列表中的。 它是android的基本和最常用的UI组件之一。 最常见的用法包括以垂直滚动列表的形式显示数据。

使用适配器 (Using an Adapter)

An adapter actually bridges between UI components and the data source that fill data into UI Component. Adapter holds the data and send the data to adapter view, the view can take the data from adapter view and shows the data on different views like as spinner, list view, grid view etc. The adapter pulls the items out of a data source, an array for example, and then converts each item into a view which it then inserts into the ListView.

适配器实际上是UI组件和将数据填充到UI组件中的数据源之间的桥梁。 适配器保存数据并将数据发送到适配器视图,该视图可以从适配器视图获取数据,并在不同的视图(例如微调器,列表视图,网格视图等)上显示数据。适配器将项目从数据源中拉出,例如一个数组,然后将每个项目转换为一个视图,然后将其插入到ListView中。

The ListView and GridView are subclasses of AdapterView and they can be populated by binding them to an Adapter, which retrieves data from an external source and creates

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值