Tôi đang thêm một mảng ImageView
giây và đặt hình ảnh cho mỗi ImageView
động và tôi đã hoàn thành nó. Nhưng vấn đề là làm thế nào để thiết lập/xác định phương pháp onClicklistener trên ImageView
?Làm thế nào để thiết lập phương pháp ImageView onClicklistener trong Android?
Đây là Mã của tôi:
ImageView[] mImages;
int[] images={R.drawable.sandle_icon1, R.drawable.sandle_icon2,
R.drawable.sandle_icon3, R.drawable.sandle_icon4};
LinearLayout ll = new LinearLayout(this);
mScrollViewImage.removeAllViews();
ll.setOrientation(LinearLayout.VERTICAL);
mImages = new ImageView[images.length];
mScrollViewImage.addView(ll);
for (floop = 0; floop < sandleicon.length; floop++) {
mImages[floop] = new ImageView(this);
mImages[floop].setImageResource(images[floop]);
ll.addView(mImages[floop]);
}
Bất kỳ giúp sẽ được đánh giá rất nhiều.
chào Dipak .... u phải tạo mảng số nguyên cho ImageView ... Mitesh Jain SKP –
Tôi đã tạo Integer Array. –