Is there a way in Android to detect if the software (a.k.a. \"soft\") keyboard is visible on screen?
If you support apis for AndroidR in your app then you can use the below method.
In kotlin :
var imeInsets = view.rootWindowInsets.getInsets(Type.ime())
if (imeInsets.isVisible) {
view.translationX = imeInsets.bottom
}
Note: This is only available for the AndroidR and below android version needs to follow some of other answer or i will update it for that.