方向特定值不会改变

发布于 2024-11-16 09:21:49 字数 295 浏览 4 评论 0原文

我在值和值域文件夹中设置了尺寸值,并将其用作布局的宽度/高度。 我在活动中以编程方式将屏幕方向更改为横向:

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

但布局尺寸不是 value-land 文件夹 dimens.xml 中声明的尺寸。

我怀疑由于方向仅特定于此活动,因此应用程序不提供更新的资源。

有没有办法改变整个应用程序的方向,或者从代码中引用景观资源?

谢谢

I got dimension values set in both values and values-land folders and used as the width/height of a layout.
I change the screen-orientation programmatically to landscape in my activity:

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

but the layout dimensions are not the ones declared in values-land folder dimens.xml.

I suspect that since the orientation is specific just to this activity, the application doesn't provide the updated resources.

Is there a way to change the orientation of the whole application, or reference to the landscape resources from code?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傲世九天 2024-11-23 09:21:49

经过一番研究,我意识到这种行为是正常的。我通过加载不同尺寸的不同布局解决了我的问题。

After some research I realized that this behavior is normal. I solved my problem by loading a different layout with different dimensions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文