我正在展示一些活动的快餐栏。现在,如果单击一个edittext,这会触发sof键盘弹出,snackbar将弹出到键盘上方。我希望键盘在快餐栏之上,因为在分层和快餐栏是不可见的,只要键盘是可见的。如何实现这一目标?
发布于 2017-07-10 12:56:38
您可以在活动的清单中简单地添加此属性:
android:windowSoftInputMode="adjustPan|stateHidden"就这样。希望这能有所帮助。
发布于 2017-07-10 12:53:41
使用这个
Snackbar snackbar = Snackbar.make(mainContent, error, Snackbar.LENGTH_LONG);
snackbar.getView().setBackgroundColor(Color.parseColor("#E32C29"));
// Changing action button text color
View sbView = snackbar.getView();
TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
textView.setTypeface(tf);
textView.setTextColor(ContextCompat.getColor(AppController.getCurrentContext(), R.color.white));
textView.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
textView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
} else {
textView.setGravity(Gravity.CENTER_HORIZONTAL);
}
snackbar.show();https://stackoverflow.com/questions/45001570
复制相似问题