課程
/移動(dòng)開發(fā)
/Android
/帶你實(shí)現(xiàn)別樣的Android側(cè)滑菜單
new?ActionBarDrawerToggle對(duì)象那個(gè)時(shí),第三個(gè)參數(shù)代表的是什么
2017-03-23
源自:帶你實(shí)現(xiàn)別樣的Android側(cè)滑菜單 3-3
正在回答
ActionBarDrawerToggle ?是?DrawerLayout.DrawerListener實(shí)現(xiàn)。
和 NavigationDrawer 搭配使用,推薦用這個(gè)方法,符合Android design規(guī)范。
作用:
1.改變android.R.id.home返回圖標(biāo)。
2.Drawer拉出、隱藏,帶有android.R.id.home動(dòng)畫效果。
3.監(jiān)聽Drawer拉出、隱藏;
做法,參照 NagatitionDrawer Demo。
重點(diǎn)在于:
/**
? * When using the ActionBarDrawerToggle, you must call it during
? * onPostCreate() and onConfigurationChanged()...
? */
?@Override
?protected void onPostCreate(Bundle savedInstanceState)
?{
? super.onPostCreate(savedInstanceState);
? // Sync the toggle state after onRestoreInstanceState has occurred.
? mDrawerToggle.syncState();
?}
?public void onConfigurationChanged(Configuration newConfig)
? super.onConfigurationChanged(newConfig);
? // Pass any configuration change to the drawer toggls
? mDrawerToggle.onConfigurationChanged(newConfig);
以及 mDrawerToggle 的初始構(gòu)造方法
mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
? mDrawerLayout, /* DrawerLayout object */
??R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
? R.string.drawer_open, /* "open drawer" description for accessibility */
? R.string.drawer_close /* "close drawer" description for accessibility */
? )
最后不要忘了
mDrawerLayout.setDrawerListener(mDrawerToggle);
舉報(bào)
學(xué)會(huì)熟練使用側(cè)滑菜單之DrawerL,介紹常用菜單開源庫SlidingMenu
2 回答R.menu.main是什么操作啊
1 回答在哪下載代碼
1 回答這是錯(cuò)誤了。。
1 回答課程下載的問題
1 回答并沒有實(shí)現(xiàn)title與菜單選中的城市同步???
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-03-24
ActionBarDrawerToggle ?是?DrawerLayout.DrawerListener實(shí)現(xiàn)。
和 NavigationDrawer 搭配使用,推薦用這個(gè)方法,符合Android design規(guī)范。
作用:
1.改變android.R.id.home返回圖標(biāo)。
2.Drawer拉出、隱藏,帶有android.R.id.home動(dòng)畫效果。
3.監(jiān)聽Drawer拉出、隱藏;
做法,參照 NagatitionDrawer Demo。
重點(diǎn)在于:
/**
? * When using the ActionBarDrawerToggle, you must call it during
? * onPostCreate() and onConfigurationChanged()...
? */
?@Override
?protected void onPostCreate(Bundle savedInstanceState)
?{
? super.onPostCreate(savedInstanceState);
? // Sync the toggle state after onRestoreInstanceState has occurred.
? mDrawerToggle.syncState();
?}
?@Override
?public void onConfigurationChanged(Configuration newConfig)
?{
? super.onConfigurationChanged(newConfig);
? // Pass any configuration change to the drawer toggls
? mDrawerToggle.onConfigurationChanged(newConfig);
?}
以及 mDrawerToggle 的初始構(gòu)造方法
mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
? mDrawerLayout, /* DrawerLayout object */
??R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
? R.string.drawer_open, /* "open drawer" description for accessibility */
? R.string.drawer_close /* "close drawer" description for accessibility */
? )
最后不要忘了
mDrawerLayout.setDrawerListener(mDrawerToggle);