【发布时间】:2014-01-22 05:48:58
【问题描述】:
我面临的问题是,我无法将新的图像按钮添加到我的 XML 文件中。我将我的图标添加到 Drawable,但它无法在图像按钮中显示。 XML 显示错误 ImageButton 类未找到。我该如何解决这个问题?
我在 xml 中收到以下错误
找不到以下类: - ImageButton(更改为 android.widget.ImageButton,修复构建路径,编辑 XML)
这是我的 xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="109dp"
android:src="@drawable/facebook" />
</RelativeLayout>
【问题讨论】:
-
请上传您的代码
-
如果您在 xml 中使用了选择器,请确保它的小写
selector而不是Selector。并确保图像名称正确。没有大写字符或特殊字符。 -
查看我的新编辑,这是我的 xml
-
你尝试过 clean + build 吗?
-
我已经尝试过清理和构建.. 但它仍然无法处理我在可绘制对象上的图像
标签: android image imagebutton