Drawable“无法解析此资源 URL”

Tho*_*hom 2 c# android xamarin.android xamarin

好的,我浏览了 android 文档,搜索了示例,并阅读了类似这样的 stackoverflow 问题:无法解析符号 @drawable/ic_launcher,但我仍然无法弄清楚发生了什么。

我的 Xamarin Android 应用程序中有一个 ImageButton,我已在 XML 文件中定义了它。这里:

    <TextView
        android:layout_width="40sp"
        android:layout_height="wrap_content"
        android:text=""
        android:gravity="center" />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/increase_quantity_button"
            android:src="@drawable/arrow_drop_up"
            android:contentDescription="@string/increaseQuantity"/>
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/decrease_quantity_button"
            android:src="@drawable/arrow_drop_down"
            android:contentDescription="@string/decreaseQuantity"/>
    </LinearLayout>
    <ImageButton
        android:layout_width="40sp"
        android:layout_height="wrap_content"
        android:id="@+id/delete_item_button"
        android:src="@drawable/delete"
        android:contentDescription="@string/delete"/>

</LinearLayout>
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/item_description"/>
Run Code Online (Sandbox Code Playgroud)

然后我将这些文件放入我的可绘制文件夹中,如下所示。

在此输入图像描述

然后,当我构建应用程序时,我得到:This resource URL cannot be resolved

我不知道下一步该尝试什么。

Nim*_*wji 6

清理您的解决方案,卸载您的项目,重新加载您的项目,然后构建它。这就像一个错误。

  • 呃!我不敢相信我没有想到尝试一下。感谢您指出显而易见的事情。 (2认同)