Je voudrais ajouter une barre d'outils pour cartographier l'activité. Le problème est que quand je l'exécute l'espace est là mais ne montre pas ma barre d'outils.Barre d'outils dans google map activity
Ceci est mon xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context="com.ruben.my_app.ui.activity.GoogleMapActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.ActionBar">
</android.support.v7.widget.Toolbar>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activity.GoogleMapActivity" />
</LinearLayout>
Ceci est le style:
<style name="AppTheme.ActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionMenuTextColor">#fff</item>
<item name="android:actionMenuTextColor">#fff</item>
</style>
Ceci est GoogleMapActivity.java:
public class GoogleMapActivity extends AppCompatActivity implements OnMapReadyCallback {
@BindView(R.id.toolbar)Toolbar toolbar;
private GoogleMap mMap;
public static int color = 0xFF1C1C1C;
public static int textColor = 0xFFFFFFFF;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_google_map);
setSupportActionBar(toolbar);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
LatLng madrid = new LatLng(40.428462, -3.704952);
mMap.addMarker(new MarkerOptions().position(madrid).title("Madrid"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(madrid,17));
}
}
supprimer le style de votre barre d'outils – akhilesh0707
vous avez appliqué le style personnalisé sur votre barre d'outils supprimer 'android: theme = "style @/AppTheme.ActionBar"' et vérifier – akhilesh0707
ISN 't cette bande blanche en capture d'écran de votre barre d'outils? –