Brightness Screen Filter

后端 未结 4 1626
暖寄归人
暖寄归人 2020-12-07 15:54

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 startin

4条回答
  •  悲&欢浪女
    2020-12-07 16:29

    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);
    }
    

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

    
    
    

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

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

提交回复
热议问题