如何将imageview传递到列表视图android
问题描述:
please see the below code
//here i call the gallery view
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this, json));
//image adapter class
public class ImageAdapter extends BaseAdapter {
Bitmap bmp;
private ImageView[] mImages;
String[] itemimage;
public ImageAdapter(Context context, JSONArray imageArrayJson) {
this.mImages = new ImageView[imageArrayJson.length()];
String qrimage;
try
{
private Image View[] mImages;
for (int i = 0; i < imageArrayJson.length(); i++) {
JSONObject image = imageArrayJson.getJSONObject(i);
qrimage = image.getString("itemimage");
byte[] qrimageBytes = Base64.decode(qrimage.getBytes());
bmp = BitmapFactory.decodeByteArray(qrimageBytes,
0,
qrimageBytes.length);
mImages[i] = new ImageView(context);
mImages[i].setImageBitmap(bmp);
my xml view
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
我可以通过使用json的url查看图像,我可以在图库布局中获得。我想获得相同的数据到listview.please帮我如何将imageview传递到列表视图android
我得到所有的JSON数据使用URL到Android我在这里传递图像适配器类在这里画廊视图可以出现使用画廊..我想要vew图像画廊列表
答
您需要编写一个自己的适配器。 而且你必须为ListView项目
提供一个自己的布局也许这次讨论给一个印象
Custom ListView adapter, strange ImageView behavior
或者本教程
我可以显示在库中的所有图片查看我想查看列表视图中的所有图像 – 2012-03-24 16:17:23
请参阅上面的代码我如何通过列表视图请帮助我 – 2012-03-24 16:29:02
我不'不要以为你的代码可以工作。也许你会检查与教程链接 – 2012-03-24 16:44:21