如何以编程方式覆盖按钮? [英] How to overlay a button programmatically?

查看:109
本文介绍了如何以编程方式覆盖按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要完成的是在运行时在屏幕中间放置一个按钮,作为最顶层,将其下方的任何内容覆盖. (它不大,所以它不会完全覆盖屏幕,无论屏幕下方是什么.)

What I would like to accomplish is to, at runtime, place a button in the middle of the screen, as the very top layer, overlaying anything below it. (It's not big, so it will not completely cover the screen, just whatever happens to be below it.)

我研究过创建一个自定义对话框,但是该对话框阻止了所有其他用户输入.我希望此新按钮下方的所有视图都能正常运行并响应用户,但我只想在所有内容上方添加(然后删除)按钮.

I looked at creating a custom dialog, however that blocks all other user input. I want all of the views below this new button to act normally and respond to the user, but I just want to add (and later remove) the button above everything.

希望这是有道理的.我只是想知道什么是最好的研究方法?

Hopefully that makes sense. I'm just wondering what might be the best approach to look into?

推荐答案

使用 FrameLayout ,该按钮是第二个子控件.当您不希望将其设置为消失"时.

Use a FrameLayout, with the button as it's 2nd child. Set it to GONE when you don't want it visible.

这篇关于如何以编程方式覆盖按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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