I fixed the problem by defining the following attribute in <activity> of AndroidManifest.xml

android:windowSoftInputMode="adjustResize"