Android, GridView, Click an Image to show full size
I want to hav开发者_JAVA技巧e a gridview where an image click displays the image full screen without creating a new activity. I have the grid set up.
GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
}
});
}
i think i need to use setImageResource(R.drawable.?);
but im just kind of confused. any help would be great
Use a Dialog with an ImageView to show this image. You would have to create a separate layout for the dialog and set it.
If you don't want to create a new activity for that, a workaround could be to use an ViewFlipper and switch between the grid and an imageview when clicking on an image. Otherwise, I don't see any way to display something fullscreen with a gridview.
精彩评论