从库中打开图像只有在Potrait模式库中、图像、模式、Potrait

2023-09-04 03:50:43 作者:渐行渐远渐陌生

我要建一个应用程序,它会从库中打开图像。图像被成功打开,但我想知道我是否可以强制在纵向模式下打开的形象呢?

这是我使用的意图:

 意向意图=新的意图(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(文件),图像/ *);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        startActivity(意向);
 

解决方案 品质保证

使用安卓screenOrientation =画像在清单中的每个<活动/> 标记......它会工作......我friend..try它

I'm building an app which will open an image from gallery. The image is opened successfully but I would like to know if I can force the image to be opened in portrait mode?

This is the Intent I'm using :

        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file),"image/*");
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        startActivity(intent);

解决方案

use android:screenOrientation="portrait" in manifest in each <activity/> tag...it will work...my friend..try it