当我创建快捷方式时,请引用 developer.android.com, 我写的代码在下面
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/share"
android:shortcutId="search"
android:shortcutShortLabel="@string/recommend_us"
android:shortcutLongLabel="@string/recommend_to_friend"
android:shortcutDisabledMessage="@string/bind_unbound">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.example.myapplication"
android:targetClass="com.yidian.news.ui.search.SearchChannelActivity" />
</shortcut>
<!-- Specify more shortcuts here. -->
一个简单的。但是当我构建项目时,出现错误消息说
错误:(2) 在包“android”中找不到属性“shortcutId”的资源标识符
错误:(2) 在包“android”中找不到属性“shortcutShortLabel”的资源标识符
错误:(2) 在包“android”中找不到属性“shortcutLongLabel”的资源标识符 错误:(2) 在包“android”中找不到属性“shortcutDisabledMessage”的资源标识符
这是为什么
已升级所有 Android SDK 和工具
最佳答案
快捷方式需要 Android 7.1。即,API 级别 25
关于android - 为什么错误 :(2) No resource identifier found for attribute 'shortcutShortLabel' in package 'android' when creating shourtcut in Android7?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41011312/