gpt4 book ai didi

android - 错误 : No resource identifier found for attribute 'roundLayout' in package "package name"

转载 作者:太空狗 更新时间:2023-10-29 13:23:18 24 4
gpt4 key购买 nike

我遇到过app:RectLayout和app:Roundlayout这两个属性的问题,在xml中报错,说有

在此行发现多个注释:
- 错误:在包中找不到属性“roundLayout”的资源标识符
'com.rarster.demowearman'
- 错误:在包中找不到属性“rectLayout”的资源标识符
'com.rarster.demowearman''
,

然后在我的主要 Activity 中也给出了一个错误,说 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>

最佳答案

  1. 所有 xml 属性都以小写字母开头。
  2. app:rectLayoutapp:roundLayout 都不应该放在 list 中!它们必须在布局文件中使用 - 在 WatchViewStub 父 View 中。

像那样:

<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 错误是错误资源文件的结果 - 它们无法成功编译。所以请修复以上问题,一切都会好起来的。

关于android - 错误 : No resource identifier found for attribute 'roundLayout' in package "package name",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25394229/

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