问题描述
我正在使用来自第三方库的活动,该活动已将android:noHistory设置为"true".在启动活动之前,是否可以在代码中覆盖该值?
I am using an activity from a third-party library that has set android:noHistory to "true". Is it possible for me to override that value in code before I launch the activity?
我可以在Intent中使用"FLAG_ACTIVITY_NO_HISTORY"标志的相反符号吗?
Is there an opposite of "FLAG_ACTIVITY_NO_HISTORY" flag I could use with the Intent?
推荐答案
在您自己的应用清单中添加< activity>
元素,并使用 android:name
属性标识活动,并使用 android:noHistory =假"
.在清单合并过程中,您应用的 android:noHistory
值应覆盖库的 android:noHistory
值.
Add an <activity>
element to your own app's manifest, with an android:name
attribute identifying the activity, and with android:noHistory="false"
. As part of the manifest merger process, your app's android:noHistory
value should override the library's android:noHistory
value.
通常,覆盖库的清单条目是有点冒险的举动,因为您可能会破坏库所依赖的内容.在这种情况下,它应该是安全的.
In general, overriding a library's manifest entry is a somewhat risky move, as you could break something that the library depends upon. In this particular case, it should be safe.
这篇关于我可以在代码中覆盖android:noHistory吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!