[英]Move EditText from bottom to top and vice-versa when keyboard opens or close with windowSoftInput as adjustNothing
[英]Tell when keyboard with "adjustNothing" opens
在我的應用程序中,我在鍵盤上使用了 adjustNothing 標志。 這是一個要求..請不要建議我將其更改為“調整大小或平移”:)
我的問題是有沒有辦法知道鍵盤在這種狀態下何時打開和關閉?
我嘗試了“onGlobalLayout”和“onConfigurationChanged”但沒有任何運氣。 由於鍵盤沒有對應用程序“執行”任何操作,因此我無法找到任何方法來捕獲此事件.. 請幫忙!
是的! 它不像 iOS 那樣可以獲取高度和動畫,但至少你知道它打開了:
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), new OnApplyWindowInsetsListener() {
@Override
public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
}
這會告訴您何時發生任何類型的更改。 很容易知道鍵盤是導致這種變化的原因並采取相應的行動。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.