“Alterar a cor da barra de status Android programaticamente” Respostas de código

Alterar a cor da barra de status Android programaticamente

 public void statuscolor(){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.parseColor(getPreferences().getString(Constant.SECONDARY_COLOR, Constant.SECONDARY_COLOR)));
        }
    }
KushalCodes

Como alterar a cor do statusBar para uma atividade no Android Studio

Window window = activity.getWindow();

// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

// finally change the color
window.setStatusBarColor(ContextCompat.getColor(activity,R.color.my_statusbar_color));
Worried Wren

cor de status do Android

 <!-- in themes -->
<item name="android:statusBarColor">@color/color</item>
Calrissian

Como alterar a cor do ActionBar no Android programaticamente

getSherlockActivity().getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff00ACED));
mActionBar.setBackgroundDrawable(new ColorDrawable(0xff00DDED));
mActionBar.setDisplayShowTitleEnabled(false);
mActionBar.setDisplayShowTitleEnabled(true);
Inexpensive Impala

Alterar o status da barra de texto Android programaticamente

WindowInsetsControllerCompat(<window>, <view>).isAppearanceLightStatusBars = Boolean
Window window = Activity.getWindow();
View view = window.getDecorView();

// You need androidx.core for this
Stupid Squirrel

Respostas semelhantes a “Alterar a cor da barra de status Android programaticamente”

Perguntas semelhantes a “Alterar a cor da barra de status Android programaticamente”

Procure respostas de código populares por idioma

Procurar outros idiomas de código