Basically I'm trying to show snackbar
at the top .But the problem is it's upper half part is going out of the screen . Can anyone please help me to resolve this issue?
Code:
Snackbar snackbar = Snackbar.make(search_btn, content, Snackbar.LENGTH_LONG);
View sbView = snackbar.getView();
sbView.setClickable(true);
sbView.setFocusable(true);
sbView.setBackgroundColor(Color.parseColor("#ffffff"));
TextView tv = sbView.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.parseColor("#001919"));
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) sbView.getLayoutParams();
params.gravity = Gravity.TOP;
sbView.setLayoutParams(params);
snackbar.show();
看起来一切都很好,也许您可以尝试向布局参数添加topMargin。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.