How to show imageView full screen on imageView click?

后端 未结 10 610
暖寄归人
暖寄归人 2020-12-02 08:41

I am getting images from url and showing it on the imageView. This functionality is working properly. But I want that when I click on that image, then it must be full screen

10条回答
  •  温柔的废话
    2020-12-02 08:57

    public class MainActivity extends Activity {
    
    ImageView imgV;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        imgV= (ImageView) findViewById("your Image View Id");
    
        imgV.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                    imgV.setScaleType(ScaleType.FIT_XY);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getSupportActionBar().hide();
                }
            }
        });
    
    }
    }
    

提交回复
热议问题