为pre-Lollipop设备实现activity转换:PreLollipopTransition
jopen
9年前
一个简单的工具,能够帮助针对为pre-Lollipop设备实现activity转换效果。
Start Activity in first activity.
findViewById(R.id.imageView).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Intent intent = new Intent(MainActivity.this, SubActivity.class); ActivityTransitionLauncher.with(MainActivity.this).from(v).launch(intent); } });
Receive intent in second activity.
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sub); ActivityTransition.with(getIntent()).to(findViewById(R.id.sub_imageView)).start(savedInstanceState); }
项目主页:http://www.open-open.com/lib/view/home/1431671736904