简体   繁体   English

'onPrepareOptionsPanel(View?, Menu): Boolean' 已弃用。 在 Java 中已弃用

[英]'onPrepareOptionsPanel(View?, Menu): Boolean' is deprecated. Deprecated in Java

I want to use this answer in Kotlin: https://stackoverflow.com/a/30337653/12478830我想在 Kotlin 中使用这个答案: https://stackoverflow.com/a/30337653/12478830

It works correctly for me but I get this warning 'onPrepareOptionsPanel(View?, Menu): Boolean' is deprecated.它对我来说可以正常工作,但我收到此警告'onPrepareOptionsPanel(View?, Menu): Boolean' is deprecated。 Deprecated in Java .在 Java 中已弃用 What should I use instead of it?我应该用什么来代替它?

From the Android source code :来自Android 源代码

/**
 * @hide
 * @deprecated Override {@link #onPreparePanel(int, View, Menu)}.
 */
@SuppressWarnings("DeprecatedIsStillUsed")
@RestrictTo(LIBRARY_GROUP_PREFIX)
@Deprecated
protected boolean onPrepareOptionsPanel(@Nullable View view, @NonNull Menu menu) {
    return super.onPreparePanel(Window.FEATURE_OPTIONS_PANEL, view, menu);
}

In other words you should use Activity.onPreparePanel(int, View, Menu) .换句话说,您应该使用Activity.onPreparePanel(int, View, Menu)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 'setHasOptionsMenu(Boolean): Unit' 已弃用。 在 Java 中已弃用 - 'setHasOptionsMenu(Boolean): Unit' is deprecated. Deprecated in Java 注册商已弃用。 在 Java 中弃用 - Registrar is deprecated. Deprecated in Java 默认显示的吸气剂:显示。 已弃用。 在 Java 中已弃用 - Getter for defaultDisplay: Display!' is deprecated. Deprecated in Java 如何处理`已弃用。 在 Java 中弃用? - How to handle `is deprecated. Deprecated in Java`? 不推荐使用“ViewModelProviders”。 Java解决方案? - 'ViewModelProviders' is deprecated. Java solution? '签名:数组&lt;(out)签名。&gt;!' 已弃用。 在 Java 中已弃用 - 'signatures: Array<(out) Signature!>!' is deprecated. Deprecated in Java 不推荐使用AppInviteReferral。 还有其他选择吗? - AppInviteReferral is deprecated. Is there an alternative? android.view.View.systemUiVisibility 已弃用。 什么是替代品? - android.view.View.systemUiVisibility deprecated. What is the replacement? Android Web-View shouldOverrideUrlLoading()已弃用。(替代方案) - Android Web-View shouldOverrideUrlLoading() Deprecated.(Alternative) isMinifyEnabled()已弃用。 有什么选择? - isMinifyEnabled() is deprecated. What is the alternative?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM