In ImageButton
I want to remove the standard button background image. In http://developer.android.com it is said, that one must define his\\her own background i
You can use android:background="@null"
for your ImageButton.
See also:
Android Developers official guide on Buttons
Using Kotlin, you can do this:
val myImageButton = ImageButton(context).apply({
background = null
// and if you need to add drawable, simply use:
setImageDrawable(ContextCompat.getDrawable(context,
R.drawable.ic_save_black_24px))
})
myButton.setBackgroundResource(0);
use the following property in your in the xml of ImageButton:
android:background="@drawable/icon"
where icon is the name of the image kept in your drawable.
No, it has to be transparent, not black. Try color: #00FFFFFF
Dot't use button.setBackgroundResource(0)
;
on some devices you will get:
android.content.res.Resources$NotFoundException: Resource ID #0x0
Better use button.setBackgroundColor(Color.TRANSPARENT);