How do I get one area in the middle of a image clickable (not the whole image)? Tried with a button set to invisible and clickable but the button does not work. What are the alternatives to an invisible / transparent button that works like a regular?
I've also thought of a completely transparent and clickable PNG that should work but maybe not the best way?
CSS Code: In this section, we will design the button using CSS property. We will use the background-color: transparent; property to set the button with transparent look. Complete Code: In this section, we will combine the above two sections to create a transparent background button.
A View's visibility status is of Integer type and can have one of three options: VISIBLE (0) - The View is visible to the user. INVISIBLE (4) - The View is invisible to the user, but still takes up space in the layout. GONE (8) - The View is invisible, and it does not take up space in the layout.
Here you go:
Button theButton = (Button)findViewById(R.id.theButton); theButton.setVisibility(View.VISIBLE); theButton.setBackgroundColor(Color.TRANSPARENT); phoneButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // DO STUFF } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With