开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜