Add dropdown to select map style

This commit is contained in:
Leith Bade
2014-11-23 16:06:50 +11:00
parent 8c5be67f14
commit 198a8eb455
8 changed files with 134 additions and 45 deletions

View File

@@ -1,7 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
tools:context="${packageName}.${activityClass}"
android:name="com.mapbox.mapboxgl.app.MapFragment"
android:id="@+id/map_fragment"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
android:background="?attr/colorPrimary">
<Spinner
android:id="@+id/spinner_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>
<fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
tools:context="${packageName}.${activityClass}"
android:name="com.mapbox.mapboxgl.app.MapFragment"
android:id="@+id/fragment_map"
android:layout_width="match_parent"
android:layout_height="fill_parent" />
</LinearLayout>

View File

@@ -2,5 +2,4 @@
<com.mapbox.mapboxgl.lib.MapView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:styleUrl="asset://styles/styles/bright-v6.json" />
android:layout_height="match_parent" />

View File

@@ -3,4 +3,13 @@
<string name="app_name">Mapbox GL</string>
<string-array name="style_list">
<item>Basic</item>
<item>Bright</item>
<item>Outdoors (Vector)</item>
<item>Outdoors (Raster)</item>
<item>Pencil</item>
<item>Satellite</item>
</string-array>
</resources>

View File

@@ -1,20 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" />
<style name="AppTheme" parent="AppBaseTheme" />
</resources>