我在我的应用程序中使用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 :(得分: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();