@Override
protected void attachBaseContext(Context newBase) {
// 시스템 "화면 크게/작게" 설정을 무시하고 고정 density 적용
android.content.res.Configuration config = new android.content.res.Configuration(newBase.getResources().getConfiguration());
android.util.DisplayMetrics metrics = newBase.getResources().getDisplayMetrics();
// 실제 픽셀 너비 기준으로 항상 360dp 화면이 되도록 density 고정
float targetWidthDp = 360f;
config.densityDpi = (int) (metrics.widthPixels / targetWidthDp * 160f);
config.fontScale = 1.0f; // 글꼴 크기 설정도 무시
super.attachBaseContext(newBase.createConfigurationContext(config));
}
'안드로이드 개발 > 개발팁' 카테고리의 다른 글
| 쿼리에서 delete 가 안될때 (0) | 2026.06.11 |
|---|---|
| 구글스토어 등록시 "명시적 공개 및 동의 요건"정책위반시 조치 방법 (0) | 2026.04.02 |
| No adapter attached; skipping layout 발생 이유 (0) | 2026.02.15 |
| 구글공식사이트에서 구버전 안드로이드스튜디오 다운받기 (1) | 2025.09.01 |
| 상태바,하단의 소프트키 가려지는 현상 해결하기 (3) | 2025.08.26 |