티스토리 뷰
public boolean hasSoftKeys() {
boolean hasSoftwareKeys = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
final Display d = getWindowManager().getDefaultDisplay();
final DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
final int realHeight = realDisplayMetrics.heightPixels;
final int realWidth = realDisplayMetrics.widthPixels;
final DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
final int displayHeight = displayMetrics.heightPixels;
final int displayWidth = displayMetrics.widthPixels;
hasSoftwareKeys = (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
} else {
boolean hasMenuKey = ViewConfiguration.get(this).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
hasSoftwareKeys = !hasMenuKey && !hasBackKey;
}
return hasSoftwareKeys;
}
'모바일 프로그래밍' 카테고리의 다른 글
Android SMS 자동인증 (0) | 2016.04.08 |
---|---|
Android Volley와 Gson 예제 (0) | 2016.04.08 |
Android 6.0 APK 빌드 안될때 proguard 문제 (0) | 2016.04.08 |
Android Studio logcat 색깔 변경 (0) | 2016.04.07 |
Android Studio auto import 설정하기 (0) | 2016.04.07 |
- Total
- Today
- Yesterday