如何实现"点击任何地方对继续]事件在我的Andr​​oid活动? [英] How to implement a "click-anywhere-to-continue" event on my android activity?

查看:144
本文介绍了如何实现"点击任何地方对继续]事件在我的Andr​​oid活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能吗?

我将显示,显示一个欢迎页面的活动,并欢迎页面没有在那里我可以附加任何意见 onClickListener

I would display an activity that shows a welcome page, and that welcome page doesn't have any Views where I can attach an onClickListener.

编辑:好的,这个欢迎这类欢迎页面的原因是,这个应用程序用于采取类似的调查......客户与调查完成后,应用程序返回到这个欢迎页面使另一人可以再次参加调查。

ok, the reason for this welcome kind of welcome page, is that this application is used to take something like a survey... after a customer is done with the survey, the app returns to this welcome page so another person can take the survey again.

推荐答案

是的,如果原来的布局是有点不恰当,使用的FrameLayout在布局的顶层实现这一目标。的FrameLayout使得堆叠的意见/布局,所以你可以有你的现有视图作为侦听触摸事件的底层,并在上面然后透明的看法:

Yes, if the original layout is somehow not appropriate, use a FrameLayout at the top level of your layout to achieve this. FrameLayout allows stackable views/layouts, so you can have your existing view as the bottom layer, and then a transparent view on top that listens for the touch event:

    <FrameLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <!-- Put your complete original layout/view here -->
        <View
            android:id="@+id/view_to_listen_for_touch"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
        />
    </FrameLayout>

这篇关于如何实现&QUOT;点击任何地方对继续]事件在我的Andr​​oid活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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