Skip to content Skip to sidebar Skip to footer

How To Add A View To Custom Listview In Android?

I have made custom listview in android activity which has progressbar. On top of that listview there is another progress bar which shows progress as day passes in the month. Now i

Solution 1:

You should add call to removeAllViews in your getView funcion:

mLinearLayout = (LinearLayout) convertView.findViewById(R.id.PuttingBar);
mLinearLayout.removeAllViews(); 
View mView =newView(mContext);

That's because LinearLayout accumulates views, and there might be multiple calls to your addView function. So you need to remove already added view before adding another PuttingBar with new margin.

Post a Comment for "How To Add A View To Custom Listview In Android?"