Android - How to create a transition from an item in listview to a whole activity?

后端 未结 4 1275
梦如初夏
梦如初夏 2021-01-30 09:35

What I want is that when the user clicks a list item in a ListView, it converts to a whole activity (as you can see in the following example), but I was not able to find a tutor

4条回答
  •  一向
    一向 (楼主)
    2021-01-30 09:54

    try this.. Material-Animations

    blueIconImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(MainActivity.this, SharedElementActivity.class);
    
            View sharedView = blueIconImageView;
            String transitionName = getString(R.string.blue_name);
    
            ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, sharedView, transitionName);
            startActivity(i, transitionActivityOptions.toBundle());
        }
    });
    

提交回复
热议问题