我有一个图像视图,下面是水平列表视图。因此,当我在水平列表视图中选择图像时,所选图像将显示在图像视图中。现在,当我单击 imageview 时,它应该以滑动图像全屏显示。我使用了视图寻呼机,但我不知道如何获取水平列表视图图像的位置并使用它。
这是一段代码:
public class ProductDetail extends Activity{
ProductImagesAdapter gallery_adapter;
PopupWindow popupMenuImage;
HorizontalListView listView;
public static int CURRENT_IMAGE=0;
List<String> imageUrl=new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.product_detail);
listView=(HorizontalListView)findViewById(R.id.product_images);
aQuery=new AQuery(this);
ivProductMain=(ImageView)findViewById(R.id.product_main_image);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
// setting listview item in imageview.
aQuery.id(ivProductMain).image(imageUrl.get(position), true, true, 0, R.drawable.default_large, BitmapFactory.decodeResource(ProductDetail.this.getResources(),
R.drawable.default_large), 0);
CURRENT_IMAGE=position;
gallery_adapter.notifyDataSetChanged();
}
});
// in post execute :
gallery_adapter=new ProductImagesAdapter(ProductDetail.this, imageUrl);
listView.setAdapter(gallery_adapter);
if(imageUrl.size()>0)
{
aQuery.id(ivProductMain).image(imageUrl.get(0), false, false, 0, R.drawable.default_large, BitmapFactory.decodeResource(ProductDetail.this.getResources(),
R.drawable.default_large), 0);
}
}
public void onclick(View clickedView)
{
switch (clickedView.getId()) {
case R.id.product_main_image:
View parentRow = (View) clickedView.getParent();
listView=(HorizontalListView)parentRow.getParent();
LayoutInflater layoutInflater = (LayoutInflater) getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
//to display single item image, it's working since i am passing current image.
/*View popupView = layoutInflater.inflate(R.layout.pinch_zoom, null);
popupMenuImage = new PopupWindow(popupView,
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
TouchImageView ivZoom=(TouchImageView)popupView.findViewById(R.id.pinch_zoom_view);
popupMenuImage.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
popupMenuImage.setOutsideTouchable(true);
popupMenuImage.setFocusable(true);
popupMenuImage.setContentView(popupView);
popupMenuImage.showAtLocation(clickedView, Gravity.CENTER, 0, 0); // Display the popup
aQuery.id(ivZoom).image(imageUrl.get(CURRENT_IMAGE), true, true, 0, R.drawable.default_large, BitmapFactory.decodeResource(ProductDetail.this.getResources(),
R.drawable.default_large), 0);*/
View popupView = layoutInflater.inflate(R.layout.image_viewpager, null);
popupMenuImage=new PopupWindow(popupView,android.app.ActionBar.LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
ViewPager viewpager= (ViewPager)popupView.findViewById(R.id.myfivepanelpager);
how to use viewpager to swipe list of images in horizontal listview after selecting main image.
break;
}
}
}
这是截图