我的應用程序有一個主要的圖片瀏覽及以下主視圖,它具有動態水平ImageView的。
代碼動態圖像視圖
ImageView imageall = new ImageView(FullImage.this);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(175, 175);
params.setMargins(10, 0, 0, 0);
imageall.setLayoutParams(params);
imageall.setBackgroundResource(R.drawable.imageview_border);
Picasso.with(context_tab1).load("http://example.com//upload/image/" + stringList.get(in)).into(imageall);
// Adds the view to the layout
layout.addView(imageall);
imageall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = (Integer) v.getTag();
image = "http://example.com/x/upload/image/" + stringList.get(position);
Picasso.with(context_tab1).load(image).into(fullimage);
}
});
}
我填充從數組列表動態ImageView的。一切工作正常,直到這部分。
問題
現在,單擊中對動態的ImageView必須得到該圖像視圖位置,改變爲主要的ImageView的。
這不適合我。
爲了更好的理解,請查找附件。
謝謝。
你可以從你的ArrayList得到位置,或者你可以爲imageview設置標籤。 – Piyush
@piyush gupta你能否提供更多的細節? – Ramz