gpt4 book ai didi

android - 如何覆盖库中 Activity 的 screenOrientation 属性

转载 作者:行者123 更新时间:2023-12-04 23:49:19 25 4
gpt4 key购买 nike

这个问题的标题并不完全反射(reflect)我的问题,因为它太长了,我已经对其进行了修剪。对不起我的英语不好。

好的,

我正在使用具有 Activity 的库,我在我的应用程序中使用该 Activity 。该 Activity 的方向在平板电脑中运行良好,即横向和纵向,但在手机中它坚持纵向模式。

当我看到该库的 list 文件时

<activity
android:name="DrawingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:finishOnTaskLaunch="true"
android:screenOrientation="unspecified">

在线程 Android Orentation Changes .我开始知道它应该像 android:screenOrientation="fullSensor"工作。

现在我正在尝试覆盖 Activity 的 screenOrientation 属性,如 here 所述

使用 tools:replace属性,但仍然无法正常工作。请任何人都可以帮我解决这个问题。

这就是我想要达到的目标。
<activity
android:name="DrawingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:finishOnTaskLaunch="true"
android:screenOrientation="fullSensor"
tools:replace="android:screenOrientation">

如果我的问题不清楚/太宽泛,请告诉我我会编辑我的问题。

问候

最佳答案

您可以使用 tools:node="merge" , 例如:

<activity android:name="DrawingActivity"
android:screenOrientation="fullSensor"
tools:node="merge">
</activity>

此节点将与现有节点合并并覆盖任何重复项。

更多详情请引用 https://developer.android.com/studio/build/manifest-merge#node_markers

关于android - 如何覆盖库中 Activity 的 screenOrientation 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39785785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com