谷歌更改的地方选择器操作栏的颜色 [英] Change Google Places picker Action bar color
问题描述
早上好,我是在Android的成色很新,我有一个问题设置在谷歌地方选取器内置的动作条的颜色。这其中的文件明确表示,操作栏颜色继承了该项目的matherial主题风格。现在的问题是,我有 Theme.AppCompat.Light.NoActionBar
键,因为它仅使用材料主题的颜色这种风格的颜色不会传递到谷歌将选择器。
我想问一下,如果它在某种程度上可以替换 Theme.AppCompat.Light.NoActionBar
与任何材料的主题,所以我可以用它来设置到位选择器操作栏的颜色。
我曾尝试以这种方式:
styles.xml
Good morning, i am quite new in Android and i have a problem setting the color of the built-in action bar in Google Places Picker. The documentation of this one clearly says that the action bar color inherits the matherial theme style of the project. The problem is that i have Theme.AppCompat.Light.NoActionBar
and the color of this style isn't passed to the Google Place Picker because it uses only the colors of material themes.
I would like to ask if it's somehow possible to replace Theme.AppCompat.Light.NoActionBar
with any material theme so i can use that to set the action bar color in place picker.
I have tried in this way:
styles.xml
<style name="AppTheme" parent="AppTheme.Base"/>
<!-- Customize your theme here. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>
V21 \\ styles.xml
v21\styles.xml
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
</style>
我的活动延伸AppCompatActivity所以当我改变材料的主题android的异常抛出,因为需要一个AppCompatStyle。
感谢您的关注。
My activity extends AppCompatActivity so when i change to Material theme android throws in exception because an AppCompatStyle is needed. Thank you for the attention.
推荐答案
我已经找到了这个问题的解决方案:
在版> 21的应用程序兼容性扩展材料的主题,因此也这种风格允许修改的地方选择器的颜色。要改变颜色,必须插入@color为主和primaryDark的价值观;这是谷歌的一个错误,isnn't还是固定的。
I have found the solution for this problem: The appcompat in version > 21 extends material theme and so also this kind of style allows to modify the place picker color. To change color, you have to insert in @color the values for "primary" and "primaryDark"; this is a bug of google that isnn't still fixed.
这篇关于谷歌更改的地方选择器操作栏的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!