Question

I have a GalleryView which I want to add ImageButton to each image in the gallery. Is this possible to do since the GalleryView is expecting a touch event?

Was it helpful?

Solution

Yes, you can catch and ignore the onItemClick from the Gallery object and set an ImageButton to each image (with a custom adapter).

Example:

Gallery g = (Gallery) findViewById(R.id.gallery);
g.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            //do nothing
        }
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top