简体   繁体   中英

onSurfaceChanged method called when soft keyboard is shown

When soft keyboard is shown, onSurfaceChanged method is called with wrong size and breaks my image capture function.

I tried below workarounds (from other stackoverflow questions) but still doesn't work:

  • Add android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
  • Add android:windowSoftInputMode="adjustSize"

Other non-desirable options:

  • Add a variable to prevent subsequent onSurfaceChanged call.
  • Change layout when soft keyboard is shown.

I'm looking for a clean & easy solution for this.

I found simple solution for this is adding below line to Android Manifest:

android:windowSoftInputMode="adjustPan"

onSurfaceChanged doesn't get called 2nd time. In addition, the surface is pushed up when soft keyboard is shown, which I like better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM