android - Scrolling GridView's items make GridView scrolls up down and will be gone -
i request see video know issue
https://www.youtube.com/watch?v=gszsmrpezsi&feature=youtu.be
gridview scrolls , gone when scroll it's item
this issue not occurring when there limited no. of items in gridview or when scroll slowly
i have taken custom gridview, in loading images , text server
below code
gridview's xml file
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" > <textview android:id="@+id/edttxtprofilequotes" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/small_margin" android:background="@drawable/blue_notification_shape" android:drawableleft="@drawable/blue_notification_icon" android:drawablepadding="@dimen/small_margin" android:gravity="center" android:textappearance="?android:attr/textappearancesmall" android:textcolor="@color/light_violet" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:adjustviewbounds="true" android:src="@drawable/teambg" /> <gridview android:id="@+id/grdgrupofunite" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/bottombar" android:layout_below="@id/edttxtprofilequotes" android:numcolumns="3" > </gridview> </relativelayout>
adapter's xml file
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/transparent" android:orientation="vertical" > <com.example.achessapp.widget.circularimageview android:id="@+id/ivunitegrpmemicon" android:layout_width="@dimen/icon_size" android:layout_height="@dimen/icon_size" android:layout_centerhorizontal="true" android:src="@android:color/white" /> <textview android:id="@+id/tvname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/ivunitegrpmemicon" android:layout_centerhorizontal="true" android:layout_margintop="@dimen/extra_small_margin" android:layout_marginbottom="@dimen/small_margin" android:gravity="center_horizontal" android:textcolor="@android:color/black" /> </relativelayout>
in activity file
adapter = new bondmemberadapter(mactivity, list_members_bean); mgridmembers.setadapter(adapter);
in adapter file
public class bondmemberadapter extends baseadapter { layoutinflater minflator; activity mactivity; private arraylist<membersbean> list_members_bean; typeface tf = null; public bondmemberadapter(activity activity, arraylist<membersbean> list) { mactivity = activity; minflator = layoutinflater.from(mactivity); list_members_bean = list; tf = typeface.createfromasset( mactivity.getassets(), constants.font_type); } @override public int getcount() { // todo auto-generated method stub return list_members_bean.size(); } @override public view getview(int position, view convertview, viewgroup parent) { viewholder viewholder; membersbean bean = list_members_bean.get(position); if (convertview == null) { convertview = minflator.inflate(r.layout.unite_grup_member_item, null); viewholder = new viewholder(); viewholder.ivuser = (circularimageview) convertview .findviewbyid(r.id.ivunitegrpmemicon); viewholder.tvname = (textview) convertview .findviewbyid(r.id.tvname); viewholder.tvname.settypeface(tf); convertview.settag(viewholder); } else { viewholder = (viewholder) convertview.gettag(); } string text = ""; text = bean.getscreen_name(); //viewholder.ivuser.setimageresource(r.drawable.unite_item); if (bean.getthumbnail_url() != null) { if (bean.getthumbnail_url().equals("null")) { imageloader.getinstance().displayimage( "drawable://" + r.drawable.profile_placeholder, viewholder.ivuser); } else { imageloader.getinstance().displayimage(bean.getthumbnail_url(), viewholder.ivuser); } } else { imageloader.getinstance().displayimage( "drawable://" + r.drawable.profile_placeholder, viewholder.ivuser); } viewholder.tvname.settext(text); return convertview; } static class viewholder { circularimageview ivuser; textview tvname; int position; } @override public object getitem(int position) { // todo auto-generated method stub return list_members_bean.get(position); } @override public long getitemid(int position) { // todo auto-generated method stub return 0; } }
Comments
Post a Comment