android ListView分页展示

2024-10-25 05:16:44

1、新建一个android项目,名称为ListViewAutoPage,其他参数可以自己配置,点击完成

android ListView分页展示

2、首先在layout文件夹下声明listviewinfo.xml,作为listView的主要样式。其内容如下:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ListView android:id="@+id/listViewInfo" android:layout_width="fill_parent" android:layout_height="wrap_content" > </ListView></LinearLayout>

android ListView分页展示

4、设置“加载更多”按钮的样式文件,loadmore.xml。其内容是:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/moreButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="加载更多" /> </LinearLayout>

android ListView分页展示android ListView分页展示android ListView分页展示

7、程序书写完毕之后,开始运行程序,观察实验结果

android ListView分页展示android ListView分页展示
猜你喜欢