Android 动画:隐藏/显示菜单
我正在尝试向我的应用程序添加一个动画,该动画将在单击时隐藏或显示菜单。基本上类似于 Pulse 新闻读者的文章视图。我能够为菜单容器设置动画。但是,当主容器为菜单支架创建空间时,菜单不会同时向下滑动。我想知道如何解决这个问题。
这是我的动画代码:
if(homeTabBar.getVisibility() == View.GONE){
homeTabBar.setVisibility(View.VISIBLE);
final Animation tabBlockHolderAnimation = AnimationUtils.loadAnimation(ArticleActivity.this, R.anim.tab_down);
tabBlockHolderAnimation.setFillAfter(true);
homeTabBar.startAnimation(tabBlockHolderAnimation);
}else{
final Animation tabBlockHolderAnimation = AnimationUtils.loadAnimation(ArticleActivity.this, R.anim.tab_up);
tabBlockHolderAnimation.setAnimationListener(new AnimationListener(){
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
homeTabBar.setVisibility(View.GONE);
}
});
tabBlockHolderAnimation.setFillAfter(true);
homeTabBar.startAnimation(tabBlockHolderAnimation);
I am trying to add an animation to my app that will hide or show a menu on single tap. Basically something similar to Pulse news readers article view. I am able to animate the menu container. However,the menu does not slide down at the same time as the main container is creating space for the menu holder. I would like to know how to fix this issue.
Here is my animation code:
if(homeTabBar.getVisibility() == View.GONE){
homeTabBar.setVisibility(View.VISIBLE);
final Animation tabBlockHolderAnimation = AnimationUtils.loadAnimation(ArticleActivity.this, R.anim.tab_down);
tabBlockHolderAnimation.setFillAfter(true);
homeTabBar.startAnimation(tabBlockHolderAnimation);
}else{
final Animation tabBlockHolderAnimation = AnimationUtils.loadAnimation(ArticleActivity.this, R.anim.tab_up);
tabBlockHolderAnimation.setAnimationListener(new AnimationListener(){
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
homeTabBar.setVisibility(View.GONE);
}
});
tabBlockHolderAnimation.setFillAfter(true);
homeTabBar.startAnimation(tabBlockHolderAnimation);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)