Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How do you make a button invisible but still active?

I am trying to create a "hot spot" on my tablet that acts like a button but users can not see the button. When I try the following I have a button but when visibility is set to "4" the user cannot interact or see it:

  Button b=(Button)findViewById(R.id.b);
      b.setOnClickListener(listener);
      b.setVisibility(4);

    public OnClickListener listener=new OnClickListener(){

        public void onClick(View arg0) {
        Intent myIntent = new Intent(MeetingManager.this,GetRoom.class);
           startActivityForResult(myIntent, 0);
        }
    };

Any ideas how I can achieve the above request?

like image 942
Denoteone Avatar asked Jan 27 '26 01:01

Denoteone


1 Answers

If it is going to be invisible, why does it have to be a button?

You can add an OnClickListener to any view.

Why not use an ImageView with a transparent background and just add the OnClickListener to that?

like image 89
MrZander Avatar answered Jan 28 '26 16:01

MrZander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!