我遇到以下属性app的问题:RectLayout和app:Roundlayout,它在xml中给出错误,说有
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'roundLayout' in package
'com.rarster.demowearman'
- error: No resource identifier found for attribute 'rectLayout' in package
'com.rarster.demowearman''
,
然后还在我的主要活动中给出一个错误,说R无法解析为变量,我正在学习本教程https://medium.com/@tangtungai/how-to-develop-and-package-android-wear-app-using-eclipse-ef1b34126a5d。我已经检查过我的布局文件夹中有roundlayout和rectlayout。任何人都可以告诉我发生了什么以及如何解决它?提前致谢
错误所在的代码是
<?xml version="1.0" encoding="utf-8"?>
<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/watch_view_stub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:rectLayout="@layout/rect"
app:roundLayout="@layout/round"
tools:context="com.rarster.demowearman.MainActivity"
tools:deviceIds="wear" >
</android.support.wearable.view.WatchViewStub>
答案 0 :(得分:2)
app:rectLayout
和app:roundLayout
都不应放在清单中!它们必须在布局文件中使用 - 在WatchViewStub
父视图中。就像那样:
<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/stub"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:rectLayout="@layout/rect"
app:roundLayout="@layout/round"
/>
您的R cannot be resolved to a variable
错误是错误资源文件的影响 - 无法成功编译它们。所以请解决上面的问题,一切都应该是好的。