亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

ActionBarDrawerToggle第三個參數代表的是什么

new?ActionBarDrawerToggle對象那個時,第三個參數代表的是什么

正在回答

1 回答

ActionBarDrawerToggle ?是?DrawerLayout.DrawerListener實現。

和 NavigationDrawer 搭配使用,推薦用這個方法,符合Android design規范。

作用:

1.改變android.R.id.home返回圖標。

2.Drawer拉出、隱藏,帶有android.R.id.home動畫效果。

3.監聽Drawer拉出、隱藏;


做法,參照 NagatitionDrawer Demo。

重點在于:


/**

? * 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 的初始構造方法

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);


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

ActionBarDrawerToggle第三個參數代表的是什么

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號