public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_MENU) {
   customOptionMenu = (FrameLayout) findViewById(R.id.CustomOptionMenu);   
   if (customOptionMenu.getChildCount() < 1) {
    
    
    customOptionMenu.setAnimation(AnimationUtils.loadAnimation(this,R.anim.menu_up));
    customOptionMenu.showContextMenu();
    
    
    linflater = (LayoutInflater) this
      .getLayoutInflater();
    smenu = linflater.inflate(R.layout.custom_option_menu,
      null);
    customOptionMenu.addView(smenu);
    findViewById(R.id.sharebtn).setOnClickListener(mClickListener);
    findViewById(R.id.bookmarksbtn).setOnClickListener(
      mClickListener);
    findViewById(R.id.artmakebtn)
      .setOnClickListener(mClickListener);
    findViewById(R.id.settingbtn)
      .setOnClickListener(mClickListener);
   } else {   
    
    customOptionMenu.setAnimation(AnimationUtils.loadAnimation(this,R.anim.menu_down));
    customOptionMenu.showContextMenu();
    customOptionMenu.removeAllViews();
    
   }
   return true;
  }
  return super.onKeyDown(keyCode, event);
 }

 

위코드는 액티비티 하단에 제가 만든 메뉴가 메뉴버튼으로 실행되는 과정입니다.

 

여기서 에니메이션을 위로 올라와서 생기고 아래로 살아지게 작동하도록 하고 싶은데

 

위로 올라와 생기는건 잘되지만 사라질때는 에니메이션이 작동 되지 않네요 ;;;

 

위로올라올때 menu_down 를 넣어우면 아래로 내려가는 동작은 잘 작동이됩니다.

 

else 부분에서 수정이 필요한 것 같은데 고수님들 좀 도와 주시면 감사하겠습니다.

 

아래는 anim/menu_up.xml 과 menu_down 입니다.

 

 <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromYDelta="100%p" android:toYDelta="0"   android:duration="400"
    />
    <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="200"/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromYDelta="0" android:toYDelta= "100%"   android:duration="500"
    />
    <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="200"/>
</set>