Android 单击可使ImageView全屏显示

Android 单击可使ImageView全屏显示,android,android-layout,imageview,android-imageview,fullscreen,Android,Android Layout,Imageview,Android Imageview,Fullscreen,我有一个有两个图像的视图 但图像并不是真正的全屏。我将如何制作全屏图像?我一直在考虑是否可以使用第三个图像视图,使其与父视图的宽度和高度匹配,并使其在单击时可见。创建另一个名为ImageZoomedActivity的活动,通过intent将图像数据传递给它(可以是url、本地文件位置等)在OnCreate方法中: requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.Layo

我有一个有两个图像的视图


但图像并不是真正的全屏。我将如何制作全屏图像?我一直在考虑是否可以使用第三个图像视图,使其与父视图的宽度和高度匹配,并使其在单击时可见。

创建另一个名为
ImageZoomedActivity
的活动,通过intent将图像数据传递给它(可以是url、本地文件位置等)在
OnCreate
方法中:

requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.popup_photo_full);
    supportPostponeEnterTransition();
    if(getIntent().hasExtra("file")) {
        imageFile = new File(getIntent().getStringExtra("file"));
        GlideApp.with(this).asBitmap()
                .load(imageFile)
                .into(image);
        supportStartPostponedEnterTransition();
    }
上面的代码使用通过intent传递的本地文件URI

这两条线

requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
让您全屏进行活动。
也可以在第一个带有缩略图的活动和第二个带有全屏图像的活动之间进行转换。如果您想了解更多信息,请向我发送pm,我可以向您发送详细的代码。

您提供的图像高度为170dp。将父对象匹配到顶级图像无法真正pm您,因为它不支持用户之间的通信或联网。有没有可能你可以发一个链接到github或者什么的?我会在pastebin上发,但我不确定我今天能不能发!我肯定会在明天@Quillion Activity A代码:Activity B(详细)代码:要使转换正常工作,请查看以下内容:
requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.popup_photo_full);
    supportPostponeEnterTransition();
    if(getIntent().hasExtra("file")) {
        imageFile = new File(getIntent().getStringExtra("file"));
        GlideApp.with(this).asBitmap()
                .load(imageFile)
                .into(image);
        supportStartPostponedEnterTransition();
    }
requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);