How to show a progress bar in each list item?

please help me show the execution dialog in a list item.

public class DealerSubCatListAdapter extends BaseAdapter { private Context context; private ArrayList<Image> Image; private LayoutInflater inflater = null; public DealerSubCatListAdapter(Context context, ArrayList<Image> Image) { this.context = context; this.Image = Image; inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); notifyDataSetChanged(); } @Override public int getCount() { return Image.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { view = inflater.inflate(R.layout.imagesubcat, null); } else { view = convertView; } TextView imagesubcat = (TextView) view.findViewById(R.id.imagesubcattv); // tagLine imagesubcat.setText(Image.get(position).image_type); return view; } } 

So this is an adapter showing a list item.

+6
source share
4 answers

Browse Listview with ProgressBar , this may help you.

+9
source

has a progress bar in R.layout.imagesubcat and declares an array of integers for progress

 int[] progress; 

in the constructor pass an array of progress

now in getview

 progressBar.setProgress(progress[position]); 

whenever any progress changes, only notifies the adapter

+3
source

If you really want to display a progress bar in each element of the list (although it seems odd to me), you can declare a progress bar in R.layout.imagesubcat

XML tag for progress bar:

  <ProgressBar android:id="@+id/progressBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /> 
+1
source

a progress dialog should be shown somewhere that you called this adapter

+1
source

All Articles