简体   繁体   English

如何将方向设置为intent.putExtra?

[英]How to set orientation to intent.putExtra?

I have add new contact button and when I press this button, android is opening system new contact page.我添加了新的联系人按钮,当我按下这个按钮时,android 正在打开系统新的联系人页面。

Opening page is android system page, not inside my app page.打开页面是android系统页面,不在我的应用页面内。

MyActivity(){

 addToContactView.setOnClickListener(view -> {
   Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI), 1);
   //intent.putExtra("orientation", "portrait"); //like this
   startActivityForResult(intent);
   });
 }

Manifest:显现:

<activity
  android:name=".MyActivity"
  android:configChanges="locale"
  android:screenOrientation="portrait"/>

I set portrait screen orientation at MyActivity.我在 MyActivity 中设置了纵向屏幕方向。 But android system new contact page is opening landscape mode.但是android系统新的联系人页面正在打开横向模式。

Can orientation be set into intent?可以将方向设置为意图吗?

You must globaly change the orientation before opening contact app.在打开联系人应用程序之前,您必须全局更改方向。 see this topic: How can I globally force screen orientation in Android?请参阅此主题: 如何在 Android 中全局强制屏幕方向?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM