进行点击活动 [英] Making a click-through Activity

查看:73
本文介绍了进行点击活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以编程方式调整手机的亮度.我的应用程序中有一个活动",该活动是半透明的,但是用户无法单击它进入其下方的活动/窗口.设置亮度后,我会立即终止此活动,但是我想在此活动中做更多的工作(例如逐渐调整亮度),这需要一些时间,我也不希望用户在手机上轻按,不知道为什么要执行此操作没有被注册.

I'm trying to adjust the brightness of my phone programmatically. I've got an Activity in my app which is translucent to do this, however users can't click through it to the activity/window beneath it. I kill this activity as soon as the brightness is set, however I want to do more work in this activity (such as gradual brightness adjustment) which requires some time, and I don't want the user tapping at their phone wondering why their actions aren't being registered.

因此,基本上,我需要创建一个模拟窗口,该窗口将成功使我能够调整屏幕亮度而不被显示,或者确定如何进行活动"点击.我也不知道该怎么办.

So basically, I need to either create a mock Window which will successfully allow me to adjust screen brightness without being displayed, or work out how to make an Activity click-through. I'm not sure how to do either.

顺便说一句,这是在Activity中进行亮度调整的代码:

BTW, this is the code making the brightness adjustments in the Activity:

android.provider.Settings.System.putInt(getContentResolver(),
            android.provider.Settings.System.SCREEN_BRIGHTNESS, Math.round(SOME_BRIGHTNESS * 255f));

Window window = getWindow(); 
window.getAttributes().screenBrightness = SOME_BRIGHTNESS;
window.setAttributes(window.getAttributes());

float sysBrightPer = getSystemBrightness(getApplicationContext());   

new Thread() {
    public void run() {
         try {
             sleep(BRIGHT_TIMEOUT);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
         finish();
    }
}.start();  

有什么建议吗?

P.S.我在市场上找到了这个应用程序.我想知道实现这一目标的方式是否对我有帮助? https://market.android.com/details?id=com.haxor

P.S. I found this app on the market. I wonder if the way this has been achieved would help me? https://market.android.com/details?id=com.haxor

推荐答案

H!该应用程序确实帮助了我,即使仅仅是因为它使我找到了该解决方案! 亮度屏幕过滤器

Hah! That app did help me, if only because it led me to this solution! Brightness Screen Filter

对于懒惰的点击,请使用此:

For the click lazy, use this:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);  

这篇关于进行点击活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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