(Android)在自定义的Adapter添加图片
main.xml
list_content.xml
问题是:上面的布局文件描述的信息是一行显示三列,怎样在自定义的Adapter添加图片,难点是我将URL存放在集合里,在集合里取出来的URL代表的是一个数据,而我要填充一行三列的数据(也就是三个数据),不知道如何按顺序地填充图片,望指教。
<?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/list_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:divider="#00000000"
android:cacheColorHint="#00000000"/>
</LinearLayout>
list_content.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/image_1"
android:layout_width="80dip"
android:layout_height="110dip"
android:layout_marginTop="15dip" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/image_2"
android:layout_width="80dip"
android:layout_height="110dip"
android:layout_marginTop="15dip" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/image_3"
android:layout_width="80dip"
android:layout_height="110dip"
android:layout_marginTop="15dip" />
</LinearLayout>
</LinearLayout>
问题是:上面的布局文件描述的信息是一行显示三列,怎样在自定义的Adapter添加图片,难点是我将URL存放在集合里,在集合里取出来的URL代表的是一个数据,而我要填充一行三列的数据(也就是三个数据),不知道如何按顺序地填充图片,望指教。
...全文
相关推荐
安卓listview相关相关-给图片添加水印这个是我自己写的上面是个listview.zip
给图片添加水印,这个是我自己写的,上面是个listview.zip,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
实现Android ListView与图片视差动画
本文还有配套的精品资源,点击获取 简介:在Android开发中,通过自定义Adapter、布局设计、滚动监听、视差计算、平滑滚动及性能优化等方法,可以实现ListView中item图片随滚动产生视差效果,增强用户界面的深度感和动态美感。该技术涉及到细节如ViewHolder模式的使用和图片加载库的应用,以及对不同设备和分辨率的兼容性测试,最终目标是为用户带来流畅且富有吸引力...
安卓Android源码——自定义本地相册的功能,可以多选图片用.rar
安卓Android源码——自定义本地相册的功能,可以多选图片用.rar
安卓Android源码——Spinner图文混排源码.zip
安卓Android源码——Spinner图文混排源码.zip
安卓Android源码——仿网易新闻listview加header图片滚动,上拉下拉刷新.zip
安卓Android源码——仿网易新闻listview加header图片滚动,上拉下拉刷新.zip


