回答

0

除了加布裏埃萊馬里奧蒂的答案。

你可能會嘗試用他提到的庫替換android.R.id.home和ActionView

查找視圖,並替換:

private void replaceHomeView(Activity activity){ 
    View homeView; 
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 
      Resources resources = activity.getResources(); 
      int id = resources.getIdentifier("android:id/home", null, null); 
      homeView = activity.getWindow().getDecorView().findViewById(id); 
     } else { 
      homeView = activity.getWindow().getDecorView().findViewById(R.id.home); 
     } 
    replace(homeView); 

} 

卸下並更換主圖標ImageView

private replace(View home){ 
    ViewGroup parent = (ViewGroup) view.getParent(); 
    int homeIndex = parent.indexOfChild(view); 
    ActionView newHome = new ActionView(home.getContext)); 
    newHome.setId(home.getId()); 
    parent.removeView(home); 
    parent.addView(newHome, homeIndex); 
} 

注:我沒有這個測試自己。

4

我已經使用balysv/material-menu庫併成功實施。

ActionView By Markushi要求API級別14+通過balysv材料菜單可以與ActionBarSherLock使用也與動畫定製。

在這裏,你有四個圖標狀態:

BURGER,ARROW,X,檢查。對於導航抽屜,您可以使用(X,CHECK)進行刪除操作並使用(BURGER,ARROW)。

enter image description here

還有一個功能,我喜歡的是壓圓動畫。在這裏,我們可以選擇按壓圓形動畫和非按壓圓形動畫。

您可以完全控制動畫,同時滑動這樣的抽屜,

enter image description here