Android Left to Right slide animation

前端 未结 9 942
旧时难觅i
旧时难觅i 2020-11-22 08:18

I have three activities whose launch modes are single instance.
Using onfling(), I swing them left and right.

The problem is when I swipe right to

9条回答
  •  感情败类
    2020-11-22 08:52

    If you want to apply the animation on "activity" start. then write below code.

    startActivity(intent);
    overridePendingTransition(R.anim.opening_anim, R.anim.closing_anim);
    

    If you want to apply the animation on "dialog" then firstly add below code in styles.xml file

    
    

    Use this style as I defined below.

    final Dialog dialog = new Dialog(activity);
    dialog.getWindow().getAttributes().windowAnimations = R.style.my_style;
    

    If you want to apply the animation on "view" then write below code

    txtMessage = (TextView) findViewById(R.id.txtMessage);
         
    // load the animation
    Animation animFadein = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animation); 
    
    // start the animation
    txtMessage.startAnimation(animFadein);
    

    Below, I have mentioned most of the animation .xml code.

    appear - make it just appear.xml

    
    
        
    
    

    ===========================================

    make it slowly fades into view.xml

    
    
        
    
    

    ==========================================

    fadeout - make it slowly fade out of view.xml

    
    
        
    
    

    ==========================================

    push_down_in.xml

    
    
        
    
    

    ==========================================

    push_down_out.xml

    
    
        
    
    

    ==========================================

    push_left_in.xml

    
    
        
        
    
    

    ==========================================

    push_left_out.xml

    
    
        
        
    
    

    ==========================================

    push_right_in.xml

    
    
        
        
    
    

    ==========================================

    push_right_out.xml

    
    
        
        
    
    

    ==========================================

    push_up_in.xml

    
    
        
        
    
    

    ==========================================

    push_up_out.xml

    
    
        
        
    
    

    ==========================================

    rotation.xml

    
    
    
    

    ==========================================

    scale_from_corner.xml

    
    
        
    
    

    ==========================================

    scale_torwards_corner.xml

    
    
        
    
    

    ==========================================

    shrink_and_rotate_a(exit).xml

    
    
    
    
    

    ==========================================

    shrink_and_rotate_b(entrance).xml

    
    
    
    
    
    

    ========================================

    blink.xml

    
    
        
    
    

    ========================================

    ZoomIn.xml

    
    
        
        
    
    

    ========================================

    ZoomOut.xml

    
    
        
        
    
    

    ========================================

    FadeIn.xml

    
    
        
    
    

    ========================================

    FadeOut.xml

    
        
    
    

    ========================================

    Move.xml

    
    
       
    
    

    ========================================

    SlideDown.xml

    
    
        
    
    

    ========================================

    SlideUp.xml

    
    
        
    
    

    ========================================

    Bounce.xml

    
    
        
    
    

提交回复
热议问题