갤탭의 경우에는 소프트키바와 알림창바 부분이 아랫부분에 동일하게 있고, 일반 스마트폰의 경우에는 윗부분에 알림창바만 존재하며 노트는 아랫부분엔 소프트키바와 윗부분에는 알림창바가 따로 존재합니다.
private void setRect()
{
Display pDefaultDisplay = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
//높이 비율
float fRatioH = Layout.sharedLayout().getHeightRatio();
//너비 비율
float fRatioW = Layout.sharedLayout().getWidthRatio();
//전체 화면 높이
int nScreenHeight = (int) (MainConstants.MAIN_HEIGHT * fRatioH);
//고정 메뉴바 높이
int nMenuHeight = (int) (MainConstants.MENU_HEIGHT * fRatioH);
int nTileTop = (int) (MainConstants.TILE_TOP * fRatioH);
int nTileHeight = (int) (MainConstants.TILE_HEIGHT * fRatioH);
int nShortCutTop = nTileTop + (nTileHeight - nMenuHeight)/2;
int nRightGap = (int)(6 * fRatioW);
boolean hasMenuKey = ViewConfiguration.get(this).hasPermanentMenuKey();
m_hRectInfo.put(MainConstants.MENU_VIEW, new Rect(0, nScreenHeight - nMenuHeight,
m_hRectInfo.put(MainConstants.MAIN_VIEW, new Rect(0, 0, pDefaultDisplay.getWidth(), nScreenHeight));
m_hRectInfo.put(MainConstants.SIDE_VIEW, new Rect(0, 0, 0, 0));
m_hRectInfo.put(MainConstants.LAND_VIEW, new Rect(0, 0, pDefaultDisplay.getHeight(), pDefaultDisplay.getWidth()));
m_hRectInfo.put(MainConstants.SHORTCUT_VIEW, new Rect(pDefaultDisplay.getWidth() - nMenuHeight - nRightGap, nShortCutTop,
pDefaultDisplay.getWidth() - nRightGap, nShortCutTop + nMenuHeight));
}
이와 같이 하드코딩을 했는데..
이와 같은 상황에서는 갤탭과 일반 스마트폰의 경우에는 화면에 이상이 없으나, 노트10.1과 같은 태블릿노트급은 고정메뉴바의 아랫부분이 짤리는 경우가 있습니다.
어느부분을 추가해야하는 지 알고 싶습니다.
if(hasMenuKey) {
m_hRectInfo.put(MainConstants.MENU_VIEW, new Rect(0, nScreenHeight - nMenuHeight, pDefaultDisplay.getWidth(), nScreenHeight));
} else {
m_hRectInfo.put(MainConstants.MENU_VIEW, new Rect(0, nScreenHeight - nMenuHeight- nSystemBarHeight, pDefaultDisplay.getWidth(), nScreenHeight));
}
인터넷에 돌아다니는 소프트키 구분 소스를 사용하면.. 전부 else구문으로 넘어가 버립니다;;;
구글링으로 찾다가 방법이 보이지않아서 글을 올리게 되었습니다;;