隐形/透明按钮的工作原理就像一个普通的机器人? [英] Invisible / transparent button that works like a regular in android?

查看:193
本文介绍了隐形/透明按钮的工作原理就像一个普通的机器人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在一个图像可点击(而不是整幅画面)的中间弄一个领域?试着用一个按钮设置为不可见和可点击,但按键不起作用。什么是替代不可见/透明按钮的工作原理就像一个普通的?

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?

我也想过一个完全透明,可点击PNG的应该工作,但也许不是最好的方法是什么?

I've also thought of a completely transparent and clickable PNG that should work but maybe not the best way?

推荐答案

在这里你去:

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
    }
});

这篇关于隐形/透明按钮的工作原理就像一个普通的机器人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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