Tecnologia do Blogger.
RSS

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

A princípio, você precisa manter o colorPrimaryDark na definição do style e não na definição da cor.

Na documentação diz o seguinte:

"To set a custom color for the status bar, use the android:statusBarColor attribute when you extend the material theme. By default, android:statusBarColor inherits the value of android:colorPrimaryDark."

Ou seja, pra customizar a cor do status bar, você usa o statusBarColor. Mas como o statusBarColor herda do colorPrimaryDark, você definindo este último seria o suficiente.

Fiz um teste aqui no aplicativo que estou fazendo, e funcionou usando a sua nomenclatura.

Também não entendi o porque de não funcionar.

Versões pré-lollipop não funciona. Você está rodando no Lollipop ou está usando compatibilidade e testando em versões pre-lollipop?
Eu rodei o aplicativo em um emulador com versão pré-lollipop pra confirmar e não funciona mesmo não. Só pra lollipop!





2015-05-12 23:04 GMT-03:00 Gink Labrev <gink.labrev@gmail.com>:
Opa. Foi mal.
Então não captei alguma coisa.

Tenho o background  da Toolbar definido da seguinte forma: <android.support.v7.widget.Toolbar ... android:background="@color/material_blue_500" />
Mas isso não altera a cor do status bar.

O theme está assim:

<style name="BlueBarMaterialDesignTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ...
        <item name="colorPrimary">@color/material_blue_500</item>
        <item name="colorPrimaryDark">@color/material_blue_700</item>
        <item name="colorAccent">@color/material_blue_A200</item>
    </style>

Não entendi porque não funciona. 
Teria que manter a nomenclatura @color/primary e @color/primary_dark para funcionar ?

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

A dica do Alexandre é via XML.

--
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