2017-12-18 120 views
0

我在我的应用程序中使用yalantis的断头台菜单,我怎样才能把关闭动画,当我点击一个项目关闭菜单。点击断头台菜单中的项目时如何放置关闭动画?

这是我到目前为止

 final View guillotineMenu = LayoutInflater.from(this).inflate(R.layout.guillotine, null); 
    root.addView(guillotineMenu); 
    LinearLayout home = (LinearLayout) findViewById(R.id.home_g); 
    home.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View view) { 
      openHomeFragment(); 

     } 
    }); 
    LinearLayout news = (LinearLayout) findViewById(R.id.news_g); 
    news.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View view) { 
      openNewsFragment(); 

     } 
    }); 

new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger) 
      .setStartDelay(RIPPLE_DURATION) 
      .setActionBarViewForAnimation(toolbar) 
      .setClosedOnStart(true) 
      .build(); 

回答

0

完成初始化GuillotineAnimation与对象。

GuillotineAnimation animation = new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger) 
      .setStartDelay(RIPPLE_DURATION) 
      .setActionBarViewForAnimation(toolbar) 
      .setClosedOnStart(true) 
      .build(); 

// Close with animation 
     animation.close();