Android Returns Error Upon Compiling After Declaring ImageButton's Background to Transparent

So I'm having a few problems with compiling my app after declaring the android:background value of an ImageButton to android:color/transparent". I've read this is the correct way to avoid having a grey border around the image from a relative post, which you can view here.

The exact error message I'm getting is the following:

Error:error: 'android:color/transparent' is incompatible with attribute android:background (attr) reference|color.

I have no idea why I'm getting this error, so if anyone has any ideas, please give me a shout as this is beyond frustrating!

Thank you.

1 answer

  • answered 2018-03-13 22:13 helmi ben khalifa

    add @ before android:color/transparent you need to write android:background="@android:color/transparent"