1.隐藏Fragment
FragmentManager fManager = getFragmentManager();
fManager.beginTransaction()
.setCustomAnimations(android.R.animator.fade_in,
android.R.animator.fade_out)
.show(yourFragmentName).commit();
fManager.beginTransaction().remove(mMangerFragment);
2.查看是否锁屏
KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
boolean locked = km.inKeyguardRestrictedInputMode();
原文:http://www.cnblogs.com/linlf03/p/3822307.html