java - Gridview not scrolling: Android -
<?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"> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/textviewselectalbum" android:layout_margintop="16dp" android:textsize="16dp" android:textcolor="@color/link_text_material_dark" android:text="select album" /> <spinner android:id="@+id/spinnerselectalbum" android:layout_width="wrap_content" android:background="@color/link_text_material_dark" android:layout_margintop="12dp" android:popupbackground="@color/material_blue_grey_900" android:layout_height="wrap_content" android:padding="10dp" android:enabled="false" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textviewalbumdescription" android:layout_margintop="16dp" android:textsize="14dp" android:textcolor="@color/link_text_material_dark" /> <gridview android:layout_width="fill_parent" android:layout_height="100dp" android:columnwidth="80dp" android:numcolumns="auto_fit" android:verticalspacing="4dp" android:horizontalspacing="4dp" android:stretchmode="columnwidth" android:gravity="center" android:id="@+id/grid"> </gridview> </linearlayout>
this layout using show grid of images downloaded facebook gridview displaying limited contents , not able scroll gridview. please me if missing something.
below getview method
public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { imageview = new imageview(context); imageview.setlayoutparams(new gridview.layoutparams(75, 75)); imageview.setscaletype(imageview.scaletype.fit_xy); } else { imageview = (imageview) convertview; } string pictureurl = photoitems.get(position).getpictureurl(); new downloadtask(imageview).execute(pictureurl); return imageview; } private class downloadtask extends asynctask<string,string,bitmap> { private final weakreference<imageview> imageviewreference; public downloadtask(imageview imageview) { imageviewreference = new weakreference<imageview>(imageview); } @override protected bitmap doinbackground(string... params) { try { string imageurl = params[0]; log.i("test","imageurl" + imageurl); bitmap bitmap = imagecache.get(imageurl); if (bitmap != null) return bitmap; bitmap = httpfetch.fetchbitmap(imageurl); log.i("test", "bitmap " + bitmap); imagecache.set(imageurl, bitmap); return bitmap; }catch (exception e) { return null; } } @override protected void onpostexecute(bitmap bitmap) { super.onpostexecute(bitmap); if(imageviewreference != null) { imageview imageview = imageviewreference.get(); if (imageview != null) { imageview.setimagebitmap(bitmap); } } } }
Comments
Post a Comment