序言:
本博客记录一下,如何使用ListView来显示一张图片加上一个文本说明。备注:这样的模式UI可以用来当主工程UI,其每个子项用来打开一个附属Library模块的Activity。我觉得这样就不错,当然界面显示没有那么丰富了。不过我想要的功能确实可以实现。写下该博客,以备忘!
正文:
1、activitity_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/lv_show"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>
2、每个子项布局文件,其实很简单就是一个ImageView控件来显示图片,一个TextView控件显示名称:(fruit_item.xml放在layout文件目录下,和activity_main.xml放在一起就可以了)