当使用ACTION_VIEW intent时,Android方向强制改变

当使用ACTION_VIEW intent时,Android方向强制改变,android,openurl,Android,Openurl,我有一个应用程序是横向模式 我将属性“android:screenOrientation=“横向”放在清单文件中 我的应用程序有以下代码 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tstore://someAppsId")); activity.startActivity(intent); 韩国普遍使用android的T-store应用程序。 T-store应用程序交易url架构“tstore://” 我的代码刚刚打开T

我有一个应用程序是横向模式

我将属性“android:screenOrientation=“横向”放在清单文件中

我的应用程序有以下代码

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tstore://someAppsId"));
activity.startActivity(intent);
韩国普遍使用android的T-store应用程序。 T-store应用程序交易url架构“tstore://”

我的代码刚刚打开T-store应用程序

不幸的是,T-store应用程序只支持纵向

有问题

在打开t-store活动之前,android操作系统会在一瞬间(0.2秒?)将我的活动方向更改为纵向模式,然后打开t-store活动

这种情况不会发生在支持横向模式的Android Market应用程序上


在这种情况下,有没有办法强烈防止方向更改?

尝试向清单文件添加
android:configChanges=“orientation”
属性。

只需从代码中设置活动的方向,这样就可以更容易地根据您的要求控制方向。设置方向的代码为,对于纵向方向

     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );
至于景观定位

     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE );

在活动中添加以下代码

肖像画

景观


回到应用程序后,应用程序是否再次切换到横向?但是如果我们已经将
android:screenOrientation=“横向”
设置到我们的活动,那么
android:configChanges=“orientation”
这将没有任何帮助。
@override
protected void onResume(){
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );
}
@override
protected void onResume(){
 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE );
}