我遇到了一个问题,我无法将新的图片按钮添加到我的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>
selector
而不是Selector
。并且请确保图像名称正确,没有大写字符或特殊字符。 - MysticMagicϡ