I am using an Intent to launch an Autocomplete Activity from the Places SDK for Android, as described here, along the following lines:
Intent intent = new Autocomplete.IntentBuilder(
AutocompleteActivityMode.FULLSCREEN, fields)
.build(this);
startActivityForResult(intent, AUTOCOMPLETE_REQUEST_CODE);
But I cannot see a way of styling the resulting Autocomplete Activity, to make it match the theme of my app as closely as possible, and in particular to follow the day/night theme being used in the app. At present the background of the places list always appears to be white, with dark text on top, i.e. suited only to a light theme.
For example the following is what it looks like, when launched from within an app running on a system set to dark theme:
How is this Activity meant to be styled?
In colors.xml
file make sure you have these defined:
<resources>
<color name="colorPrimary">#ffffff</color>
<color name="colorPrimaryDark">#03DAC5</color>
<color name="colorAccent">#03d</color>
</resources>
In styles.xml
you should have this defined:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
With that I was able to change the colors of the Places SDK.
colorPrimary
is used for the background surrounding the EditText
colorPrimaryDark
is used for the status bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With