Android Material design transitions

前端 未结 4 1384
故里飘歌
故里飘歌 2021-01-30 13:59

I want to replicate the transitions as explained in Material design by Google. This is the link for the preview, but basically the videos I care about are those two:

    <
4条回答
  •  清酒与你
    2021-01-30 14:27

    Step 1:Consider that you are moving from one activity to other.So define onclick method for button

       button= (Button) findViewById(R.id.button);
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(getApplicationContext(), Animation.class);
                   startActivity(intent, options.toBundle());
                        startActivity(intent);
                   overridePendingTransition  (R.anim.right_slide_in, R.anim.right_slide_out);
                }
            });
    

    Step 2:Now define the animation that you need for the second activity while launching

    anim.right_slide_in

    
    
        
    
    

提交回复
热议问题