I have an app in which there is a FramLayout
with id frame_container
.
My onCreate looks like this :-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
hideKeyboard();
editText = findViewById(R.id.editText4);
editText.setSelection(editText.getText().toString().length());
textView = findViewById(R.id.textView3);
frameLayout = findViewById(R.id.frame_container);
frameLayout.setVisibility(View.INVISIBLE);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.frame_container,new advancefunction());
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
frameLayout.animate().translationXBy(1000f);
}
When I press a button it just brings my fragment with animation by using function :-
@Override
public void advanceButton(View view) {
frameLayout.setVisibility(View.VISIBLE);
frameLayout.animate().translationXBy(-1000f).setDuration(500);
}
So when I press backButton it goes to previous state but instead I want it to get invisible
and translationXby(1000f)
any suggestions how to achieve it as i am a new to android and still learning so a help would be great.