1.游玩南昌
从上一篇博客【鸿蒙】鸿蒙App应用-《校园通》开发步骤中,点击主页面中的游玩南昌,进入以下界面,整个界面的显示是有列表组件完成,每一条数据由图片,名称和简介三部分组成。
2.布局搭建
在layouot文件夹下新建xml布局文件,外层使用线性布局控制整个界面的显示,内部使用列表组件用于显示列表信息。
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:orientation="vertical">
<ListContainer
ohos:id="$+id:lc_list"
ohos:height="match_parent"
ohos:width="match_parent"/>
</DirectionalLayout>
3.初始化数据
- 创建AbilitySlice类,准