I facing the problem that, I cant add new image button to my XML file.I added my icons to Drawable, but It cannot show in image button. XML shows an error ImageButton class not found. How can I solve this ?
I got the following error in xml
The following classes could not be found: - ImageButton (Change to android.widget.ImageButton, Fix Build Path, Edit XML)
Here is my 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>
Why dont you try a simple button instead of image button. Here is a code i have on some of my buttons with image.
android:drawableTop="@drawable/three"
: this is basically the image
android:background="@drawable/buttonstyles"
: this is a style for the button. No need to use it. Or the other layout features i have.
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button2"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="@drawable/buttonstyles"
android:drawableTop="@drawable/three"
android:onClick="goToSettings"
android:text="Settings" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With