2016-11-03 3 views
1

ich ein Layout mit nur einiger vertikalen Taste aufweisen, die in linearem Layout ist, will Animation für alle Schaltfläche festlegen, wenn Popup-Show zum Beispiel dieser Anime für alle SchaltflächeSet Animation für Popup-Elemente, wenn Pop-up erstellen

Animation animation = 
    new TranslateAnimation(0, 0, -size, size); 
    animation.setDuration(1000); 
    animation.setFillAfter(false); 
    animation.setInterpolator(new BounceInterpolator()); 

dieser Code ist für Pop-up

   LayoutInflater inflater = (LayoutInflater) getActivity() 
         .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
       View layout = inflater.inflate(
         R.layout.popup_buy, 
         (ViewGroup) getView().findViewById(
           R.id.popup_element)); 
       pwindo = new PopupWindow(layout, 
         WindowManager.LayoutParams.FILL_PARENT, 
         WindowManager.LayoutParams.FILL_PARENT, true); 
       pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0); 

zu schaffen, und ich weiß, dass ich mit diesem Code-Taste zugreifen kann

   Button btn1 = (Button) layout.findViewById(R.id.btn_opt1); 

aber wie kann ich anim für alle button wenn popup erstellen?

Antwort

0

folgender Code verwendet für Set-Animation auf eine Ansicht

btn1 .startAnimation(animation); 
0

Nach Versuch anythings ich von diesem Code verwendet, und mein Problem gelöst mit Timer! :(

  pwindo.setAnimationStyle(R.style.PopUp_Animation);//OPS : 500 ms 
      pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0); 
      final Button btn1 = (Button) layout.findViewById(R.id.btn); 
      final Timer tm = new Timer(); 
      tm.scheduleAtFixedRate(new TimerTask() { 

       @Override 
       public void run() { 
        tm.cancel(); 
        anim_list_ anim_list = new anim_list_(); 

        float loc1 = btn1.getTop(); 
        Animation list_v_anim1 = anim_list.list_v(Height,loc2,50); 
        btn1.startAnimation(list_v_anim1); 
       } 
      }, 1, 550/*550 here !*/);