设定全屏时一些有虚拟键导航栏的手机导航栏还是在的,如果要去掉就必须用特殊方法了。如下:
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import com.mgyun.general.helper.Logger;
/**
* Created by AndyMao on 2015/12/21.
*/
public class NavigationBarHelp {
/**
* 是否有虚拟键
*
* @return
*/
public static boolean hasNavigationBar(Context context) {
boolean hasMenuKey = true, hasBackKey = true;
boolean ret = false;
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
}
if ((!hasMenuKey) && (!ha