【问题标题】:How can I resolve "No resource identifier found" for attributes in my Android project?如何解决我的 Android 项目中属性的“未找到资源标识符”?
【发布时间】:2016-09-05 20:08:28
【问题描述】:

我正在尝试在 Xamarin Studio 中实现一个简单的 GridLayout,如下例所述:

http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-creating-a-numeric-keypad-with-gridlayout/

<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:columnCount="4"
    android:orientation="horizontal" >
    <Button
        android:layout_column="3"
        android:text="/" />
    <Button android:text="1" />
    <Button android:text="2" />
    <Button android:text="3" />
    <Button android:text="*" />
    <Button android:text="4" />
    <Button android:text="5" />
    <Button android:text="6" />
    <Button android:text="-" />
    <Button android:text="7" />
    <Button android:text="8" />
    <Button android:text="9" />
    <Button
        android:layout_gravity="fill"
        android:layout_rowSpan="3"
        android:text="+" />
    <Button
        android:layout_columnSpan="2"
        android:layout_gravity="fill"
        android:text="0" />
    <Button android:text="00" />
    <Button
        android:layout_columnSpan="3"
        android:layout_gravity="fill"
        android:text="=" />
</GridLayout>

但它不会构建。我收到以下错误:

 Error: No resource identifier found for attribute 'columnCount' in package 'android' (AndroidApplication1)
 Error: No resource identifier found for attribute 'layout_rowSpan' in package 'android' (AndroidApplication1)
 Error: No resource identifier found for attribute 'layout_columnSpan' in package 'android' (AndroidApplication1)
 Error: No resource identifier found for attribute 'layout_columnSpan' in package 'android' (AndroidApplication1)

我需要进行哪些更改才能完成这项工作?

【问题讨论】:

  • 这是在更新到 rev 22 工具后发生的吗?如果检查此stackoverflow.com/questions/16636039/…
  • 我已更新到 rev22,但我不知道在此之前是否存在问题,因为自更新以来我只尝试过此示例。但是,因为我在 Xamarin(即 C#)中执行此操作,所以我不知道 Java 构建路径是否适用于此问题...?
  • 如果您使用的是 eclipse,请尝试评论中的链接

标签: android xamarin.android xamarin grid-layout


【解决方案1】:

尝试显式添加对 support:gridlayout-v7 的依赖,即使您已经对 support:preference-v7 有依赖。

如果你使用的是 gradle,它在 build.gradle (Module app) 中应该是这样的: 编译'com.android.support:gridlayout-v7:23.0.+'

【讨论】:

    猜你喜欢
    • 2018-08-25
    • 2015-11-30
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多