How can I create a sliding layout, like the main android menu?

前端 未结 4 1163
天涯浪人
天涯浪人 2021-02-04 17:27

I need to create an application with 4 view. I need to pass from a view to an other simply by a touch and a move to the left or to the right (no button). The effect I would like

4条回答
  •  失恋的感觉
    2021-02-04 18:02

    I think you can use layout animation for the purpose..

    res/anim/popin.xml:

    
      
    
    

    res/anim/popinlayout.xml:

    
    

    Source:

    // Applying a Layout Animation and Animation Listener
    aViewGroup.setLayoutAnimationListener(new AnimationListener() {
      public void onAnimationEnd(Animation _animation) {
        // TODO: Actions on animation complete. 
      }
      public void onAnimationRepeat(Animation _animation) {}
      public void onAnimationStart(Animation _animation) {}
    });
    
    aViewGroup.scheduleLayoutAnimation();
    

提交回复
热议问题