I am working with android layout in which when I am hiding Proceed to Payment Button as well as Bottom View when Key board is showing, similarly when user press back or done Button in Keyboard keyboard will hide now mean time I am showing save address Button also Bottom View, To check the visibility of key board I am using following solluation and its working fine but the Problem is when KeyBoard hide it take jerk as layout recize
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);
}
});
As showing in above code
when keyboard show layout then a glitch will occur as layout
is resizing,to avoid this I use onPostDelay()
as shown below
@Override
public void onSoftKeyboardClosed() {
mBinding.activityRoot.postDelayed(new Runnable() {
@Override
public void run() {
mBinding.actionProceedToPayment.setVisibility(View.VISIBLE);
mHomeActivityImplementation.handleBottomTabs(true);
}
}, 100);
}
but still facing same problem. I also apply CountDownTimer()
but problem not solved and Is there any method to avoid this jerk ?