Android屏蔽home键

2.2版本

	@Override
	public void onAttachedToWindow() {   
	    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);   
	    super.onAttachedToWindow();   
	}  


4.0版本

	public static final int FLAG_HOMEKEY_DISPATCHED = 0x80000000;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.getWindow().setFlags(FLAG_HOMEKEY_DISPATCHED, FLAG_HOMEKEY_DISPATCHED);//关键代码    ......}


 

你可能感兴趣的:(Android屏蔽home键)