如何programmically覆盖一个按钮? [英] How to overlay a button programmically?

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

问题描述

我想完成的是,在运行时,放置一个按钮在屏幕的中间,作为最上层的,覆盖下的所有内容。 (这不是很大的,所以它不会完全覆盖屏幕,只是无论发生什么事是它下面。)

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.

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

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