title: Toolbar won't display as action bar in Android Studio
body: <p>I'm currently trying to implement a <code>NavigationDrawer</code> within my application and have been following the Android Developer guide as to how this is implemented.</p>
  
  <p>However, when trying to set a custom <code>Toolbar</code> as the <code>ActionBar</code>, the <code>Toolbar</code> does not display within the application, almost as if the <code>setSupprtActionBar()</code> method does not do anything.</p>
  
  <p>I think it is an issue with setting the themes as <code>.NoActionBar</code> somewhere incorrectly but I have tried changing them but have had no success.</p>
  
  <p><strong>EDIT:</strong> Following ʍѳђઽ૯ท's suggestions, here is the updated code which still does not show the toolbar.</p>
  
  <p>Here is my <code>MainActivity.java</code>:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      private DrawerLayout mDrawerLayout;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          // Sets custom toolbar as default toolbar and imports menu icon
          Toolbar toolbar = findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          // Creates navigation drawer
          mDrawerLayout = findViewById(R.id.drawer_layout);
  
          NavigationView navigationView = findViewById(R.id.nav_view);
          navigationView.setNavigationItemSelectedListener(
                  new NavigationView.OnNavigationItemSelectedListener() {
                      @Override
                      public boolean onNavigationItemSelected(MenuItem menuItem) {
                          // set item as selected to persist highlight
                          menuItem.setChecked(true);
                          // close drawer when item is tapped
                          mDrawerLayout.closeDrawers();
  
                          // Add code here to update the UI based on the item selected
                          // For example, swap UI fragments here
  
                          return true;
                      }
                  });
      }
  </code></pre>
  
  <p>Here is my <code>activity_main.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
  
          &lt;android.support.v7.widget.Toolbar
              android:id="@+id/toolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="?attr/colorPrimary"
              android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
              android:elevation="4dp" /&gt;
  
          &lt;FrameLayout
              android:id="@+id/content_frame"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  
      &lt;/LinearLayout&gt;
  
              &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="@color/colorBackground"&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"
                      android:padding="12dp"&gt;
  
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/weather_mode_card"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:layout_marginBottom="14dp"&gt;
  
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:background="#fff"
                              android:elevation="4dp"
                              android:padding="10dp"&gt;
  
                              &lt;ImageView
                                  android:id="@+id/weather_mode_icon"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentTop="true"
                                  android:layout_marginTop="6dp"
                                  android:layout_marginEnd="10dp"
                                  android:src="@drawable/icon_weather" /&gt;
  
                              &lt;TextView
                                  android:id="@+id/weather_mode_title"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentTop="true"
                                  android:layout_toEndOf="@+id/weather_mode_icon"
                                  android:paddingBottom="5dp"
                                  android:text="@string/weather_mode"
                                  android:textSize="20sp" /&gt;
  
                              &lt;TextView
                                  android:id="@+id/weather_mode_desc"
                                  android:layout_width="220dp"
                                  android:layout_height="wrap_content"
                                  android:layout_below="@+id/weather_mode_title"
                                  android:layout_toEndOf="@+id/weather_mode_icon"
                                  android:layout_toStartOf="@id/weather_mode_button"
                                  android:text="@string/weather_mode_desc"
                                  android:textColor="#8b8b8b"
                                  android:textSize="14sp" /&gt;
  
                              &lt;Button
                                  android:id="@+id/weather_mode_button"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentEnd="true"
                                  android:layout_centerVertical="true"
                                  android:text="@string/mode_button"/&gt;
  
                          &lt;/RelativeLayout&gt;
  
                      &lt;/android.support.v7.widget.CardView&gt;
  
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/wifi_mode_card"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:layout_marginBottom="14dp"&gt;
  
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:background="#fff"
                              android:elevation="4dp"
                              android:padding="10dp"&gt;
  
                              &lt;ImageView
                                  android:id="@+id/wifi_mode_icon"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginTop="6dp"
                                  android:layout_alignParentTop="true"
                                  android:layout_marginEnd="10dp"
                                  android:src="@drawable/icon_wifi" /&gt;
  
                              &lt;TextView
                                  android:id="@+id/wifi_mode_title"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentTop="true"
                                  android:layout_toEndOf="@+id/wifi_mode_icon"
                                  android:paddingBottom="5dp"
                                  android:text="@string/wifi_mode"
                                  android:textSize="20sp" /&gt;
  
                              &lt;TextView
                                  android:id="@+id/wifi_mode_desc"
                                  android:layout_width="220dp"
                                  android:layout_height="wrap_content"
                                  android:layout_below="@+id/wifi_mode_title"
                                  android:layout_toEndOf="@+id/wifi_mode_icon"
                                  android:layout_toStartOf="@id/wifi_mode_button"
                                  android:text="@string/wifi_mode_desc"
                                  android:textColor="#8b8b8b"
                                  android:textSize="14sp" /&gt;
  
                              &lt;Button
                                  android:id="@+id/wifi_mode_button"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentEnd="true"
                                  android:layout_centerVertical="true"
                                  android:text="@string/mode_button"/&gt;
  
                          &lt;/RelativeLayout&gt;
  
                      &lt;/android.support.v7.widget.CardView&gt;
  
                      &lt;android.support.v7.widget.CardView
                          android:id="@+id/temp_mode_card"
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:layout_marginBottom="14dp"&gt;
  
                          &lt;RelativeLayout
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:background="#fff"
                              android:elevation="4dp"
                              android:padding="10dp"&gt;
  
                              &lt;ImageView
                                  android:id="@+id/temp_mode_icon"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_marginTop="6dp"
                                  android:layout_alignParentTop="true"
                                  android:layout_marginEnd="10dp"
                                  android:src="@drawable/icon_temp" /&gt;
  
                              &lt;TextView
                                  android:id="@+id/temp_mode_title"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentTop="true"
                                  android:layout_toEndOf="@+id/temp_mode_icon"
                                  android:paddingBottom="5dp"
                                  android:text="@string/temp_mode"
                                  android:textSize="20sp" /&gt;
  
                              &lt;TextView
                                  android:id="@+id/temp_mode_desc"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_below="@+id/temp_mode_title"
                                  android:layout_toEndOf="@+id/temp_mode_icon"
                                  android:layout_toStartOf="@id/temp_mode_button"
                                  android:text="@string/temp_mode_desc"
                                  android:textColor="#8b8b8b"
                                  android:textSize="14sp" /&gt;
  
                              &lt;Button
                                  android:id="@+id/temp_mode_button"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_alignParentEnd="true"
                                  android:layout_centerVertical="true"
                                  android:text="@string/mode_button"/&gt;
  
                          &lt;/RelativeLayout&gt;
  
                      &lt;/android.support.v7.widget.CardView&gt;
  
                  &lt;/LinearLayout&gt;
  
              &lt;/ScrollView&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/nav_view"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:fitsSystemWindows="true"
          app:menu="@menu/drawer_view"
          app:headerLayout="@layout/nav_header" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>Here is my <code>styles.xml</code>:</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;!-- Base application theme. --&gt;
      &lt;style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt;
          &lt;!-- Customize your theme here. --&gt;
          &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt;
          &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt;
          &lt;item name="android:colorForeground"&gt;@color/foreground_material_light&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="AppTheme.NoActionBar" parent="AppTheme"&gt;
          &lt;item name="windowActionBar"&gt;false&lt;/item&gt;
          &lt;item name="windowNoTitle"&gt;true&lt;/item&gt;
      &lt;/style&gt;
  
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>And here is my <code>AndroidManifest.xml</code>:</p>
  
  <pre><code>&lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>