I made a snackbar on the top of my layout. BUT, when it appears, it slides upwards and when it is dismissed, it slides downwards. My wish is to make it appear from the top of the screen and slides down, and vice-versa.
CoordinatorLayout coordinatorLayout = findViewById(R.id.v_set_bgs);
snackbar = Snackbar.make(coordinatorLayout, R.string.changes, Snackbar.LENGTH_INDEFINITE);
View view = snackbar.getView();
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
params.gravity = Gravity.START;
TextView snackbarText = view.findViewById(android.support.design.R.id.snackbar_text);
snackbarText.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
view.setLayoutParams(params);
view.setAlpha(0.75f);
if (snackbarShow && isAlready == 0 && AppSettings.isChanged) {
isAlready = 1;
snackbar.show();
}
So. So far, it's working like a normal snackbar (on the top of the layout). I just couldn't find any method how to change the slide direction.