Using ToolBar in MapActivity
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 4 Sep 2016 01:21:38 +0000 (03:21 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 4 Sep 2016 01:21:38 +0000 (03:21 +0200)
app/src/main/java/name/gumartinm/weather/information/activity/MapActivity.java
app/src/main/res/layout/weather_about.xml
app/src/main/res/layout/weather_map.xml

index 8550807..63ac19a 100644 (file)
@@ -28,6 +28,7 @@ import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
 import android.view.View;
 import android.widget.Button;
 import android.widget.TextView;
@@ -73,8 +74,10 @@ public class MapActivity extends AppCompatActivity implements
         super.onCreate(savedInstanceState);
         this.setContentView(R.layout.weather_map);
 
+        final Toolbar toolbar = (Toolbar) findViewById(R.id.weather_main_toolbar);
+        this.setSupportActionBar(toolbar);
+
         final ActionBar actionBar = this.getSupportActionBar();
-        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
         actionBar.setDisplayHomeAsUpEnabled(true);
         actionBar.setDisplayShowHomeEnabled(true);
         actionBar.setIcon(R.drawable.ic_launcher);
index 3316c59..a3268e4 100644 (file)
 -->
 <!-- The main content view -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:orientation="vertical"
     android:padding="0dip"
     android:gravity="center_horizontal"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    tools:context="name.gumartinm.weather.information.activity.AboutActivity">
 
     <include layout="@layout/weather_general_toolbar"/>
 
index 5b73a6c..a45f5c0 100644 (file)
     android:layout_gravity="center"
     tools:context="name.gumartinm.weather.information.activity.MapActivity" >
 
+       <include layout="@layout/weather_general_toolbar"/>
+
     <LinearLayout
         android:id="@+id/weather_map_citycountry_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-               android:layout_alignParentLeft="true"
-        android:layout_alignParentStart="true" >
+               android:layout_below="@+id/weather_main_toolbar" >
        <LinearLayout
                android:id="@+id/weather_map_city_container"
                android:layout_width="0dp"