Muhittin Kaya
Muhittin Kaya

Reputation: 71

Is it possible to make transparent just one instance of custom button?

I have a custom button and its background is blue. I have used it in many activities but just in 1 place I want to make my button transparent without effecting other.

So how can I make transparent just one instance of custom button in my project?

Upvotes: 1

Views: 38

Answers (2)

Nagoor Bhasha
Nagoor Bhasha

Reputation: 66

You can declare variable in custom component. Initialize the variable only in the class you want to make the component as transparent. Override on draw method apply transparent bg to canvas.

Upvotes: 2

Francesco Bocci
Francesco Bocci

Reputation: 867

You can add this in your XML: android:background="?android:attr/selectableItemBackground"

or this in your code: buttonVariable.setBackgroundColor(Color.TRANSPARENT);

Upvotes: 0

Related Questions