android - 如何在android清单文件中设置纵向和横向
问题描述
纵向模式正常工作,横向未显示。
android:screenOrientation="portrait" // 这里我需要同时显示纵向和横向。
解决方案
参考文档:点击这里
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Fragment locked in portrait screen orientation
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// Fragment locked in landscape screen orientation
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// Fragment screen orientation normal both portait and landscape
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
希望,这将为您提供预期的解决方案。
推荐阅读
- amazon-web-services - 在 Cognito 用户池中注册时如何检查用户是否已经存在具有相同的电子邮件或电话号码
- bash - 使用 awk 命令解析 /etc/passwd 而不为每一行创建输出文件并从那里读取
- r - 维恩图未在 highcharter 包中呈现
- angular - matTreeNodeDef 迭代上的角垫树无法从 ngfor 获取索引
- c++ - 控制一个字符串是否存在于另一个字符串中(在 C++ 中)
- python - 命令“python setup.py egg_info”在/tmp/pip-build-tu6ygqzj/mysql-python/中失败,错误代码为1
- docker - 如何使用 docker-compose 构建 docker 镜像
- java - 如何使用名称中的增量值以编程方式实例化新的 JSONObject
- javascript - POST 加载时显示 JAVASCRIPT 的问题
- c++ - 如何使 getline 命令在 while 循环中工作?