Advertisement

Android学习笔记:滚动控件ListView的使用方法

阅读量:

ListView作为APP开发中广泛采用的组件之一,其操作方式相较于其他组件更为繁琐,但所具备的功能也更为全面和强大,常被应用于菜单展示、列表呈现等场景。

一、ListView基本用法

ListView的基础操作流程:

1、构建ListVIew的界面结构

2、实例化ArrayAdapter对象

3、实现ArrayAdapter与ListView的关联

启动新的工程ListViewTest,采用默认配置,对activity_main.xml文件进行修改,具体代码如下所示:

复制代码
 <?xml version="1.0" encoding="utf-8"?>

    
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    
     android:layout_width="match_parent"
    
     android:layout_height="match_parent">
    
  
    
     <ListView
    
     android:id="@+id/list_view"
    
     android:layout_width="wrap_content"
    
     android:lay

全部评论 (0)

还没有任何评论哟~