在我的活动中仅为 1 个片段设置方向,而其余片段为纵向 [英] Setting the orientation for only 1 fragment in my activity while the rest is in portrait

查看:16
本文介绍了在我的活动中仅为 1 个片段设置方向,而其余片段为纵向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要处于纵向模式,因此我通过以下方式在清单中设置它:

My app needs to be in portrait mode so I set it in the manifest by:

android:screenOrientation="portrait"

但我最近刚刚添加了另一个片段 (FragA),它在横向上的外观和功能都提高了 10 倍.有什么我可以在我的 FragA 中放入的东西,让该片段以横向方式呈现,同时将应用程序的其余部分保留为纵向,或者通过这样做,我是否必须向我的其他片段添加一些内容以将它们保留为纵向?

But I just recently added another fragment (FragA) that just looks and functions 10x better in landscape. Is there something I can put inside of my FragA to just make that fragment in landscape while retaining the rest of the app in portrait or by doing this will I have to add something to my other fragments to keep them retained as portrait?

推荐答案

Orientation 属性是针对每个活动的,因此您可以只为包含片段的活动声明方向,使其处于横向状态,而其余活动将保留就像他们一样.

Orientation attribute is per activity so you can declare the orientation for only the activity that contains the fragment so that it is in landscape and the rest of the activities will remain as they are.

这篇关于在我的活动中仅为 1 个片段设置方向,而其余片段为纵向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆