Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Barra no topo do Android - Mudar de cor

@rudson e @alexandre

Valeu. Fiz assim:

if (Build.VERSION.SDK_INT >= 21) {      Window window = getWindow();      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);      window.setStatusBarColor(getResources().getColor(R.color.material_blue_700));  }
Sabe se é possível deixar definido no xml ?


Abs,

Em 12 de maio de 2015 14:23, Alexandre M. Carvalho Petraglia <alexmcarv@gmail.com> escreveu:
Geralmente, essa barra de status tem um tom acima da cor da toolbar.
Caso você esteja usando o tema do material deisgn, pode fazer o seguinte:

No styles.xml terá o seguinte:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
Então você cria um arquivo colors.xml
<resources>
<color name="primary">#009688</color>
<color name="primary_dark">#00796B</color>
<color name="accent">#FFC107</color>
</resources>
E a toolbar, você coloca o background: android:background="@color/primary"
Então a toolbar terá a cor colorPrimary e a barra de status do android ficará na cor do "colorPrimaryDark".
Caso deseje as duas na mesma cor, basta mudar o colorPrimaryDark pra mesma cor do colorPrimary.
Abraço,
Alexandre


2015-05-12 13:09 GMT-03:00 Rudson Lima <rudsonlive@gmail.com>:

O que você procura é isso Window.setStatusBarColor(), e aqui tem mais informações do Material Design

http://developer.android.com/training/material/index.html

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário