亮度屏幕过滤器过滤器、亮度、屏幕

2023-09-12 04:01:26 作者:我媳妇是我心肝ら

有没有人有一个想法,如何实现最后的一个成员的亮度屏幕过滤器:

Does anyone have an idea how to implement an Brightness Screen Filter like the one here:

http://www.appbrain.com/app/screen-filter/ com.haxor

我需要为出发点,我无法弄清楚如何做到这一点。

I need a starting point and I can't figure out how to do it.

推荐答案

只是做一个透明的全屏幕活动,让触摸通过。为了使触摸以下窗口标志经过使用设置内容查看之前:

Just make a transparent full screen activity that lets touches pass through. To make touches pass through use the following Window flags before setting the contentView:

@Override
public void onCreate(Bundle savedInstanceState)
{
  super.onCreate(savedInstanceState);
  Window window = getWindow();

  // Let touches go through to apps/activities underneath.
  window.addFlags(FLAG_NOT_TOUCHABLE);

  // Now set up content view
  setContentView(R.layout.main);
}

有关您的main.xml布局文件只使用一个全屏幕的LinearLayout具有透明背景的:

For your main.xml layout file just use a full screen LinearLayout with a transparent background:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/background"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#33000000">
</LinearLayout>

然后调整亮度只是改变的背景颜色值从code的地方:

Then to adjust the "brightness" just change the value of the background colour from your code somewhere:

findViewById(R.id.background).setBackgroundColor(0x66000000);