use of org.aisen.android.ui.fragment.ATabsFragment in project AisenWeiBo by wangdan.
the class MainActivity method setFragemnt.
private void setFragemnt(final Fragment fragment, CharSequence title) {
if (fragment == null)
return;
toolbarTitle = title.toString();
getSupportActionBar().setTitle(toolbarTitle);
// 如果是TabsFragment,显示TabLayout
if (fragment instanceof ATabsFragment) {
tabLayout.setVisibility(View.VISIBLE);
} else {
tabLayout.setVisibility(View.GONE);
}
// 显示AppBarLayout
appBarLayout.setExpanded(true, true);
// .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
View view = findViewById(R.id.content_frame);
view.setAlpha(0.0f);
ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f);
anim.setDuration(600);
anim.start();
getFragmentManager().beginTransaction().replace(R.id.content_frame, fragment, "MainFragment").commit();
}
Aggregations