Android的 - 你怎么做一个按钮,看不见但仍然活跃? [英] Android - How do you make a button invisible but still active?

查看:277
本文介绍了Android的 - 你怎么做一个按钮,看不见但仍然活跃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建我的平板电脑热点那就像一个按钮,但用户无法看到按钮。当我尝试下面我有一个按钮,但是当可见性设置为4的用户不能进行交互或者看到它:

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?

推荐答案

如果这将是无形的,为什么它必须是一个按钮?

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

您可以添加的 OnClickListener 以任何看法。

You can add an OnClickListener to any view.

为什么不使用的的ImageView 的透明背景,只是添加 OnClickListener

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

这篇关于Android的 - 你怎么做一个按钮,看不见但仍然活跃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆