λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
πŸ’»Tech/🌡android

[μ•ˆλ“œλ‘œμ΄λ“œ] μžλ°”μ½”λ“œλ‘œ 단말 해상도 κ΅¬ν•˜λŠ” 방법

by _viper_ 2016. 1. 8.
λ°˜μ‘ν˜•

μžλ°” μ½”λ“œμƒμ—μ„œ 단말기(폰)에 해상도λ₯Ό κ΅¬ν•˜λŠ” λ°©λ²•μž…λ‹ˆλ‹€. 해상도별 μž‘μ—…ν• λ•Œ μœ μš©ν•©λ‹ˆλ‹€.

DisplayMetrics dm = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(dm);

Toast.makeText(getApplicationContext(),"해상도: " + dm.widthPixels + "x" + dm.heightPixels,Toast.LENGTH_SHORT).show();