开发者

How to open another activity with the desired screen orientation?

I need to preview PDF file, but run viewer in a landscape fixed mode. Here is my current source code:

Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

Is there a way to开发者_C百科 say it should view it in landscape mode ? Thanks in advance!

EIDT: PDF viewer is 3rd party app


Tell the user to turn their phone.

Each application determines on its own how to handle screen orientation. You have no ability to override how other applications behave, any more than they have the ability to override how you behave.

EDIT: To clarify, this assumes that you are trying to open a third-party PDF viewer. @Kurru's answer is correct for activities of your own that you write.


I believe you can do this by setting in your manifest on the activity you want to be in landscape mode

android:screenOrientation="landscape"

This only works for Activities you control

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜