i just started with Android Studio and i'am creating a hamburger icon, now everything works fine but the hamburger icon is not visible, the menu closes and open like expected and can be clicked but the icon is not visible.any help will be greatly appreciated.
Activity file
package com.example.greyhound;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
private DrawerLayout draw ;
ActionBarDrawerToggle toggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar tool = findViewById(R.id.toolbar);
setSupportActionBar(tool);
draw = findViewById(R.id.hamburger);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,draw,tool,R.string.open_menu,R.string.close_menu);
draw.addDrawerListener(toggle);
toggle.syncState();
}
}
Layout files...
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/hamburger"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="@layout/menu_layer"
app:menu="@menu/burger_menu">
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
Menu Layer
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@color/colorAccent">
</LinearLayout>
and style sheet
<!-- Base application theme. -->
<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>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
i tried adding/removing the layout files , still the problem persists. I assumed the problem in style files, so i set "windowActionBar" as true , i looked here as well.