Android ListView don't smooth scroll using ViewHolder -


hello , sorry list view scroll issue, i'm implementing list view on android doesn't scrolls smoothly. have added viewholder pattern , have tried set textview row still doesn't work. , don't think i'm doing work on ui threat cause container activity have 3 static buttons.

here adapter getview function:

public view getview(int position, view convertview, @nonnull viewgroup parent) {      viewholder holder;      if (convertview == null) {          // if it's not recycled, initialize attributes         layoutinflater inflater = (layoutinflater) mcontext                 .getsystemservice(context.layout_inflater_service);          // layout reference         convertview = inflater.inflate(r.layout.row_search, parent, false);          holder = new viewholder();          // reference layout         holder.ivcolorsearch = convertview.findviewbyid(r.id.vi_color_search);         holder.tvcolordesc = (textview) convertview.findviewbyid(r.id.tv_color_desc);         holder.position = position;          convertview.settag(holder);      } else {          holder = (viewholder) convertview.gettag();     }      // set colo+r description     holder.tvcolordesc.settext(dataset.get(position).name + "\n" + fandecknames.get(dataset.get(position).fandeck));      // set image color     gradientdrawable drawable = (gradientdrawable) holder.ivcolorsearch.getbackground();     int color = color.parsecolor(dataset.get(position).colorcode);     drawable.setcolor(color);      // set listener     holder.ivcolorsearch.setonclicklistener(this);     holder.tvcolordesc.setonclicklistener(this);      holder.ivcolorsearch.settag(position);     holder.tvcolordesc.settag(position);      return convertview; } 

as can see every row have view(it image view i'm trying improve it) set it's background color , textview. if remove set image , set text code blocks directly doesn't scroll, can't understand why.

here list view xml declaration (it in custom view):

    <relativelayout          xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="200dp"  android:layout_height="match_parent"  android:layout_gravity="fill_horizontal"  android:orientation="vertical"  android:visibility="gone"  android:background="@android:color/black"  android:layout_alignparentend="true"  android:layout_margintop="50dp"  android:layout_marginbottom="50dp">   <!-- search field --> <edittext     android:id="@+id/et_search"     android:layout_width="190dp"     android:layout_height="50dp"     android:hint="@string/search"     android:inputtype="textfilter"     android:layout_marginstart="5dp"     android:background="@drawable/rounded_corners_edittext"/>  <!-- colors list --> <listview     android:id="@+id/lv_search_colors"     android:layout_width="200dp"     android:layout_height="wrap_content"     android:scrollbars="none"     android:layout_margintop="50dp"     android:divider="@null"> </listview>  </relativelayout> 

and here row code:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ll_language_item" android:orientation="horizontal" android:layout_width="200dp" android:layout_height="50dp">  <view     android:id="@+id/vi_color_search"     android:layout_width="46dp"     android:layout_height="46dp"     android:layout_margin="2dp"     android:background="@drawable/rounded_corners_image"/>  <textview     android:id="@+id/tv_color_desc"     android:layout_width="150dp"     android:layout_height="50dp"     android:textcolor="@android:color/white"     android:lines="2"     android:textalignment="center"/>   </linearlayout> 

thanks in advance, if need more info, please ask, i've been issue since saturday, have tested lots of different solutions think better way implement list view.

solved, i'm sorry, fault. overriding on touch listener of list view in container activity.

an advice: don't copy paste jeje


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -