且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我可以在代码中覆盖android:noHistory吗?

更新时间:2023-09-19 23:11:16

我正在使用第三方库中的一项活动,该活动已将android:noHistory设置为"true".

I am using an activity from a third-party library that has set android:noHistory to "true".

在您自己的应用清单中添加< 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.