I have application that start with Main Activity and after pressing on "next button a new fragment was created.
My problem is that after pressing on the "Next" button, the new fragment animated from top.
I would like to disable this animation but I found that nothing work on web.
This is the main results I found but nothing work for me :
This is part of my code: ...//inside button click listener
case R.id.btnNext:
if(Maindb.getSingleSetting("isFisrtTime").equals("true"))
{
String str = Maindb.getSingleSetting("isFisrtTime");
fragmentLanguage = new ActChooseLanguage();
if (fragmentLanguage != null) {
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame_container, fragmentLanguage).commit();
}
}
else
{
fragmentHome = new ActHome();
if (fragmentHome != null) {
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame_container, fragmentHome).commit();
}
}
break;
And this is main part of the fragment:
public class ActChooseLanguage extends Fragment{
private View rootView ;
DrawerLayout mDrawerLayout;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getActivity().overridePendingTransition(0, 0);
rootView = inflater.inflate(R.layout.activity_choose_language, container, false);
ImageButton btnACMenu = (ImageButton) getActivity().getActionBar().getCustomView().findViewById(R.id.imgHamburger);
btnACMenu.setVisibility(View.INVISIBLE);
getActivity().getIntent().addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
getActivity().getActionBar().show();
return rootView;
}
@Override
public void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
.
.
.
}
If there are another solution please let me know. Thanks
UPDATE:
The problem happened because of the ActionBar and not the Fragment, the solution is bellow.