Android

์•ˆ๋“œ๋กœ์ด๋“œ ์ƒํƒœ๋ฐ” (statusBar) ์—†์• ๊ธฐ

๋…ธ๋ฃจ๋ฃฝ 2021. 7. 17. 00:45

์•ˆ๋“œ๋กœ์ด๋“œ ์ƒํƒœ๋ฐ” (statusBar) ์—†์• ๊ธฐ

SplashActivity๋ฅผ ๋งŒ๋“ค ๋•Œ ๊ผญ ํ•„์š”ํ•œ ์ƒํƒœ๋ฐ” ์—†์• ๋Š” ๋ฐฉ๋ฒ•!

์–ธ์–ด๋Š” ์ฝ”ํ‹€๋ฆฐ ์ž…๋‹ˆ๋‹ค.

class SplashActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)

        // ์ƒํƒœ๋ฐ” ์—†์• ๊ธฐ
        @Suppress("DEPRECATION")
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
            window.insetsController?.hide(WindowInsets.Type.statusBars())
        } else {
            window.setFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN
            )
        }
    }
}