Reputation: 1849
I created a simple ImageButton in my app and im using and image in it.
I had like that when I click the button that it wont show that it was clicked (not sure how it is called but when the button changes color).
My button looks as follows:
and when I click it becomes:
<ImageButton
android:id="@+id/returnButton"
style="?android:borderlessButtonStyle"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_rarrow"
app:layout_constraintBottom_toBottomOf="@+id/tv_Username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_Username">
</ImageButton>
I want to remove this gray background even when clicked because it shows boundaries that I wish to hide.
Thank you
Upvotes: 1
Views: 3976
Reputation: 91
Within your code, you can use this:
button.setBackgroundColor(Color.TRANSPARENT);
Upvotes: 0
Reputation: 40898
You can apply a transparent background to the ImageButton
android:background="@android:color/transparent"
Upvotes: 2
Reputation: 1234
Apply a background to the Button
:
android:background="@android:color/white"
Upvotes: 0
Reputation: 137
You can solve the problem by adding one line of code.
android:background="@null"
Hoping it will be helped
Upvotes: 1