0

I want to share one specific layout of base activity so when Transition between activites occurs, this layout remain unchanged. Any Suggestions?

e.g. I have a custom tab bar in base activity that I dont want to change

2 Answers2

1

Add this to yuor Layout in XML

android:transitionName="yourLayoutName"

and change your startActivity call to this

ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, (View)yourLayout, "yourLayoutName");
startActivity(intent, options.toBundle());
0

As per your example, create a parent activity and add the toolbar in that activity. Below that toolbar, add your fragments. And transition should be done in your fragments. It is recommended to use fragments instead of activities unless activity is required as fragments are light weight and fast. Plus, managing backstack is much easier in fragments then activities.

Malwinder Singh
  • 6,644
  • 14
  • 65
  • 103