I am working in an android application and I want to implement a Gallery. And on my getView method now I return a Image View. In this method I want to return a button and an Image View. How can I do this.
Thanks in advance
This is ma code :
ImageView imageView = new ImageView(mContext);
imageView.setImageResource(mImageIds[position]);
imageView.setLayoutParams(new Gallery.LayoutParams(150, 180));
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setBackgroundResource(mGalleryItemBackground);
return imageView;
If I understand what you’re asking, you’ll need to create a ViewGroup (LinearLayout, for example, but all layouts are ViewGroups) and place your ImageView and Button within this container. You will return the ViewGroup from your getView method.