2017-07-09 91 views
0

我在一些活動上顯示快餐欄。現在,如果點擊一個觸發軟鍵盤彈出的編輯文本,小吃棒就會彈奏到鍵盤上方。我希望鍵盤在分層上方,如同分層一樣,只要鍵盤可見,快餐欄就不可見。 如何才能實現這一目標android:在軟鍵盤下面隱藏小吃店

+1

你檢查了這個[處理輸入法可見性](https://developer.android.com/training/keyboard-input/visibility.html) – zombie

回答

1

什麼,你可以簡單地做在你的活動清單中添加這個屬性:

android:windowSoftInputMode="adjustPan|stateHidden" 

就是這樣。希望這可以幫助。

0

使用本

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();