How to implement the “parent-to-child” navigational transition as prescribed by Material Design

前端 未结 4 1486
北荒
北荒 2020-12-05 07:44

Google\'s Material Design guidelines prescribe the following transition for \"parent-to-child\" transitions when the parent consists of a list. (Material Design Guidelines)

4条回答
  •  孤城傲影
    2020-12-05 08:41

    One option is to use ActivityOptionsCompat.makeScaleUpAnimation

    Activity activity = getActivity();
    Intent intent = new Intent(activity, OtherActivity.class);
    Bundle options = ActivityOptionsCompat.makeScaleUpAnimation(
        sourceView, 0, 0, sourceView.getWidth(), sourceView.getHeight()).toBundle();
    
    ActivityCompat.startActivity(activity, intent, options);
    

    This will cause the new activity to expand vertically and horizontally outwards from your sourceView

提交回复
热议问题