본문 바로가기

Development/Android

Material Desigin appcompat-v7:22.0.0 toolbar 토글 아이콘

gradle dependency:
compile 'com.android.support:appcompat-v7:22.0.0'


import all of:
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.content.res.Configuration;


styles.xml :
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">


in Activity :

// 툴바 토글 리스너를 드로어레이아웃 리스너에 연결
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.app_name, R.string.app_name);
mDrawerLayout.setDrawerListener(mDrawerToggle);
// appcompat-v7:22.0.0 일때 아래를 추가하면 토글 아이콘이 나타남
getSupportActionBar().setDisplayHomeAsUpEnabled(true);