如何更改 mapview flutter 的颜色应用栏?
how to change color appbar of mapview flutter ?
你好,我搜索更改 mapview 插件的颜色以进行 flutter。
这是link
https://github.com/apptreesoftware/flutter_google_map_view
据我所知,插件调用 android 和 ios 本机代码来创建地图。
我搜索了 android 的 kotlin 代码,但我没有看到任何颜色属性来更改应用栏颜色。如果有人知道如何在插件中添加简单的 ios android 代码来更改颜色,那就完美了。谢谢
您可以尝试设置自定义主题:
添加到您的 styles.xml 文件:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
将所有 @color/color...
替换为您的颜色代码,其中 colorPrimary 是您 AppBar 的颜色。
作为参考,这设置了 AndroidManifest.xml 中的主题:
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>
而here是关于主题的文档。
转到位于 res/values 的 styles.xml 文件并添加以下 slyle:
<style name="MapViewTheme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">#008000</item>
</style>
并在清单中引用此样式,如下所示:
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="@style/MapViewTheme"/>
在上面的示例中,我将颜色更改为绿色 (#008000)。将此值更改为您想要的颜色。
你好,我搜索更改 mapview 插件的颜色以进行 flutter。
这是link https://github.com/apptreesoftware/flutter_google_map_view
据我所知,插件调用 android 和 ios 本机代码来创建地图。 我搜索了 android 的 kotlin 代码,但我没有看到任何颜色属性来更改应用栏颜色。如果有人知道如何在插件中添加简单的 ios android 代码来更改颜色,那就完美了。谢谢
您可以尝试设置自定义主题:
添加到您的 styles.xml 文件:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
将所有 @color/color...
替换为您的颜色代码,其中 colorPrimary 是您 AppBar 的颜色。
作为参考,这设置了 AndroidManifest.xml 中的主题:
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>
而here是关于主题的文档。
转到位于 res/values 的 styles.xml 文件并添加以下 slyle:
<style name="MapViewTheme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">#008000</item>
</style>
并在清单中引用此样式,如下所示:
<activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="@style/MapViewTheme"/>
在上面的示例中,我将颜色更改为绿色 (#008000)。将此值更改为您想要的颜色。