private ProgressBar progressLoading() { ProgressBar pb = new ProgressBar(getContext()); pb.setIndeterminateDrawable(getContext().getResources().getDrawable(R.drawable.progress)); TableLayout.LayoutParams params = new TableLayout.LayoutParams( TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT); params.setMargins(0, (int) (ratio * 100), 0, 0); params.gravity = Gravity.CENTER; params.height = (int) (ratio * 45); params.width = (int) (ratio * 45); pb.setLayoutParams(params); pb.setTag(1000); return pb; }
@Override public Object instantiateItem(ViewGroup container, int position) { View view = LayoutInflater.from(context).inflate(R.layout.gallerypic_item, null); PhotoView photoView = (PhotoView) view.findViewById(R.id.galleryitem_pv); // photoView.setMinScale(16f); galleryitem_pb = (ProgressBar) view.findViewById(R.id.galleryitem_pb); boolean hidpb = ((GalleryActivity) context).isReadyMap.get(position); galleryitem_pb.setTag(position); if (hidpb) { galleryitem_pb.setVisibility(View.GONE); } else { galleryitem_pb.setVisibility(View.VISIBLE); } setShowView(position, photoView); container.addView(view); return view; }