问题
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
<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>
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.
回答1:
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.
来源:https://stackoverflow.com/questions/30523366/change-google-places-picker-action-bar-color