我與Android的佈局工作中,當我躲在前往付款按鈕以及底視圖當鍵盤被顯示,類似的用戶按BACK或完成按鈕時在鍵盤的鍵盤現在隱藏的平均時間我顯示保存地址按鈕也底視圖,要檢查鍵盤的我使用 following solluation的知名度和它工作正常,但問題是當鍵盤隱藏它採取挺舉作爲佈局重新調整安卓:避免挺舉當隱藏軟鍵盤
softKeyboardStateWatcher = new SoftKeyboardStateWatcher(mBinding.activityRoot);
softKeyboardStateWatcher.addSoftKeyboardStateListener(new SoftKeyboardStateWatcher.SoftKeyboardStateListener() {
@Override
public void onSoftKeyboardOpened(int keyboardHeightInPx) {
mBinding.actionProceedToPayment.setVisibility(View.GONE);
mHomeActivityImplementation.handleBottomTabs(false);
}
@Override
public void onSoftKeyboardClosed() {
mBinding.actionProceedToPayment.setVisibility(View.VISIBLE);
mHomeActivityImplementation.handleBottomTabs(true);
}
});
如above code
示出當鍵盤顯示佈局則毛刺將發生如layout
是在調整大小,以避免這一點,我使用onPostDelay()
如下所示
@Override
public void onSoftKeyboardClosed() {
mBinding.activityRoot.postDelayed(new Runnable() {
@Override
public void run() {
mBinding.actionProceedToPayment.setVisibility(View.VISIBLE);
mHomeActivityImplementation.handleBottomTabs(true);
}
}, 100);
}
但仍面臨着同樣的問題。我也申請CountDownTimer()
但問題沒有解決,是否有任何方法來避免這個混蛋?
我同意@Gabe Sechan +1 –