안드로이드 상태 바

2889 단어 androidandroid

안드로이드 상태바 및 상태바 아이콘 색깔 변경

// Make Activity Get Transparent Status Bar With Defined Icon Color
fun makeTransparentStatusBar(activity: AppCompatActivity) {
    activity.window.apply {
        clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
        // Extends Background Layout
        addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        if(Build.VERSION.SDK_INT >=  Build.VERSION_CODES.R) {
            // Status Bar Icon Color Black
            decorView.windowInsetsController?.setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS)
            
            // Status Bar Icon Color White
            // decorView.windowInsetsController?.setSystemBarsAppearance(0, APPEARANCE_LIGHT_STATUS_BARS)
        }
        // Status Bar Color Transparent
        statusBarColor = Color.TRANSPARENT
    }
}

좋은 웹페이지 즐겨찾기