gpt4 book ai didi

java - 错误: Multiple annotations found at this line:

转载 作者:行者123 更新时间:2023-12-01 12:50:53 26 4
gpt4 key购买 nike

我正在我的应用程序中实现 searchview,为此我从 searchview 的单独工作项目复制了此 options_menu.xml。

我在 res/menu/options_menu.xml 中收到此错误

Multiple annotations found at this line:
- error: No resource identifier found for attribute 'actionViewClass' in package
'com.example.indianconstitution'
- error: No resource identifier found for attribute 'showAsAction' in package
'com.example.indianconstitution'

代码:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto">

<item android:id="@+id/action_search" // error in this line
android:icon="@drawable/ic_launcher"
android:title="@string/action_search"
yourapp:actionViewClass="android.support.v7.widget.SearchView"
yourapp:showAsAction="always" />

</menu>

有人能解决这个问题吗?

提前致谢...

最佳答案

看起来您已将其从使用 appcompat-v7 的项目复制到不使用 appcompat-v7 的项目中。

要么包含 appcompat-v7,按照说明进行操作,要么仅将 yourapp:x 属性替换为 android:x 属性。不过,如果您这样做,您还应该将操作 View 类替换为框架中相应的 View 类(即 android.widget.SearchView)。

关于java - 错误: Multiple annotations found at this line:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24222081/

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