Reputation: 1145
In my software keyboard the candidates view overlaps user application and hides the bottom part of the UI.
This happens in Android 6.0 and higher. The same APK works fine in Android 4.4. The onMeasure() handlers for keyboard view and candidates view are implemented in the following way:
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int rwidth = MeasureSpec.getSize(widthMeasureSpec);
int w = Math.min(InputViewMetrics.screenWidth, rwidth);
int h = InputViewMetrics.candidatesViewHeight;
this.setMeasuredDimension(w, h);
}
I also call setCandidatesViewShown() with true or false depending on the input mode, but toggling the candidates view does not fix the overlap. Again, this behavior is not occurring in previous versions of Android. The app is compiled for compatibility with the following lines in the manifest:
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="26" />
What can be done to fix this overlap? How do I ensure that the user app refreshes its layout when the candidates view visibility changes?
Upvotes: 2
Views: 225
Reputation: 2149
This is a little late but may be helpful for someone else. I fixed it overriding the onComputeInsets:
override fun onComputeInsets(outInsets: Insets?) {
super.onComputeInsets(outInsets)
if (!isFullscreenMode) {
outInsets?.contentTopInsets = outInsets?.visibleTopInsets
}
}
Upvotes: 1