Example #1
0
 @OnClick(R.id.navbar_right)
 public void switchBranckList(TextView button) {
   if (mapIsShow) {
     button.setText("地图");
     mListview.setVisibility(View.VISIBLE);
     Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.home_pop_menu_enter);
     mListview.setAnimation(animation);
   } else {
     button.setText("列表");
     Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.home_pop_menu_exit);
     mListview.setAnimation(animation);
     mListview.setVisibility(View.GONE);
   }
   mapIsShow = !mapIsShow;
 }
Example #2
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   // 获取ListView组件
   ListView list = (ListView) findViewById(R.id.list);
   WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
   Display display = windowManager.getDefaultDisplay();
   DisplayMetrics metrice = new DisplayMetrics();
   // 获取屏幕的宽和高
   display.getMetrics(metrice);
   // 设置对ListView组件应用动画
   list.setAnimation(new MyAnimation(metrice.xdpi / 2, metrice.ydpi / 2, 3500));
 }