package com.duguang.baseanimation.ui.imitate.taobaoPath2; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.RelativeLayout; import com.duguang.baseanimation.R; /** * 淘宝菜单2 的主页面 * @author Administrator * */ public class PathMenuMainActivity extends Activity { /** Called when the activity is first created. */ private boolean areButtonsShowing; private RelativeLayout composerButtonsWrapper; private ImageView composerButtonsShowHideButtonIcon; private RelativeLayout composerButtonsShowHideButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_imitate_taobao_path2_main); MyAnimations.initOffset(PathMenuMainActivity.this); composerButtonsWrapper = (RelativeLayout) findViewById(R.id.composer_buttons_wrapper); composerButtonsShowHideButton = (RelativeLayout) findViewById(R.id.composer_buttons_show_hide_button); composerButtonsShowHideButtonIcon = (ImageView) findViewById(R.id.composer_buttons_show_hide_button_icon); composerButtonsShowHideButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (!areButtonsShowing) { MyAnimations.startAnimationsIn(composerButtonsWrapper, 300); composerButtonsShowHideButtonIcon .startAnimation(MyAnimations.getRotateAnimation(0, -270, 300)); } else { MyAnimations .startAnimationsOut(composerButtonsWrapper, 300); composerButtonsShowHideButtonIcon .startAnimation(MyAnimations.getRotateAnimation( -270, 0, 300)); } areButtonsShowing = !areButtonsShowing; } }); for (int i = 0; i < composerButtonsWrapper.getChildCount(); i++) { composerButtonsWrapper.getChildAt(i).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { } }); } composerButtonsShowHideButton.startAnimation(MyAnimations .getRotateAnimation(0, 360, 200)); } }