0

I added a imagebutton in my application but when i run my app it show the error
like

Error:(44, 22) No resource found that matches the given name (at 'src' with value '@drawable/searchIcon').

Here is my Xml code

<ImageButton
    android:id="@+id/imageButton2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/searchIcon"
    app:layout_constraintTop_toTopOf="parent"
    android:layout_marginTop="10dp"
    android:layout_marginRight="5dp"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintLeft_toRightOf="@+id/editText"
    android:layout_marginLeft="10dp" />

I added the searchIcon image in the drawable folder eventhough i getting the error.
ThankYou

Raj kumar
  • 21
  • 2
  • 6

3 Answers3

1

Resource names should not contain any capital letters. Rename your drawable to ic_search (to comply to naming standards as well).

1

You can't use uppercase in resource name, so you need to change it to something like this:

search_icon

Related question:
Why is it not possible to use uppercase in naming resources in android?

Community
  • 1
  • 1
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
0

Resources name should not be in Uppercase letters You can chhange to this

search_icon

vishal pardeshi
  • 334
  • 4
  • 14