Art*_*ans 8 android android-theme google-places-api google-play-services
我正在使用Google Play服务中的PlacePicker库来启动新活动.新活动/选择器有一个工具栏(操作栏),默认情况下没有设置样式.
PlacePicker文档说明了这一点
如果使用材质主题在应用程序中设置自定义颜色,则场所选择器将从主题继承colorPrimary和colorPrimaryDark属性.
我的style.xml文件中有一个主题:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#5665bb</item>
<item name="android:colorPrimary">#5665bb</item>
<item name="colorPrimaryDark">#41456b</item>
<item name="android:colorPrimaryDark">#41456b</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我已经设置了在Android Manifesto文件中使用的主题
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud)
placepicker由以下代码创建:
try {
PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
Intent intent = intentBuilder.build(Main.this);
// Start the intent by requesting a result,
// identified by a request code.
startActivityForResult(intent, REQUEST_PLACE_PICKER);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
Log.e("", "Error with Google Play lib.");
}
Run Code Online (Sandbox Code Playgroud)
但是,工具栏不会设置样式.和以前一样,它有白色背景和黑色文字.有趣的是,我自己的工具栏(动作栏)确实得到了样式.
如何强制使用placepicker活动来采用我的主题?
| 归档时间: |
|
| 查看次数: |
1946 次 |
| 最近记录: |