Gridview - Click image to view image in Viewpager

前端 未结 4 1149
慢半拍i
慢半拍i 2021-01-01 00:23

This is a gridview that get image from json. and it works fine. I want to click image in this gridview to show full image and can slide it. I find the solution of this probl

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-01 00:50

    its same as you need. just click event of grid view and get image in next screen using view pager.

    Click event of grid view images:

    GridView gridView = (GridView) findViewById(R.id.gridview);
            gridView.setAdapter(new ImageAdapter());
            gridView.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView parent, View view,
                        int position, long id) 
             {
              HashMap selected = (HashMap)  
    
              gridView.getItemAtPosition(position);
    
                }
            });
    

提交回复
热议问题