上按一下按钮显示弹出图像 [英] Displaying popup images on button click

查看:151
本文介绍了上按一下按钮显示弹出图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅在URL中给出的形象 的http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185M2RneG5nYmNm&hl=en

Please refer the image given in the url http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185M2RneG5nYmNm&hl=en

我的查询是,我怎么能显示与圆形按钮和表行的消息,当我点击圆形按钮与问号。

My query is, How can I display the messages corresponding to the rounded buttons and the table row , when I click on the rounded button with question mark.

我知道,我必须使用监听器?按钮,但我应该做的听众完全,这样,当我点击,它显示这些警报(图像),当我再次点击,它就会消失。

I know, I have to use listener for the ? button , but what should I do in listener exactly, such that when I click, it shows those alerts(images) and when I click again, it disappears.

有关此UI,我已经使用相对布局,建议在这里 - 对齐组件在所需位置 - 和它的工作非常适合我。

For this UI, I have used Relative layout as was suggested here -- Aligning components at desired positions -- and it worked perfect for me.

所以,我需要完全改变我的基地布局的完成呢?

So, do I need to change my base layout altogether for accomplishing this?

推荐答案

您可以使用的FrameLayout 为基准,为您的UI布局,然后添加一个 ImageView的覆盖。例如:

You can use a FrameLayout as the base for your ui layout and then add an ImageView overlay. For example:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/MainFrame"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <!-- Put your normal layout stuff here -->

</FrameLayout>

然后在你的code您可以创建的ImageView ,并把它添加到大型机,它会覆盖你的用户界面,像这样的:

Then in your code you can create the ImageView and add it to the MainFrame and it will overlay your UI, like this:

FrameLayout mainFrame = (FrameLayout)findViewById(R.id.MainFrame);
ImageView overlay = new ImageView(this);
overlay.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.overlay));
mainFrame.addView(overlay);

再后来,你可以调用:

Then later you can call:

mainFrame.removeView(overlay);

有它走了。

这篇关于上按一下按钮显示弹出图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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