Question

I've been working on the Android Sample SoftKeyboard. It makes a fair bit of sense, but I've run into a problem. The Keyboard will only fill approximately 88% of the screen (480px of a 540px screen).

I'm developing on an Atrix 4G, which apparently has a problem with 2.3.4, from what I can tell, the original devices with qHD screens don't show most keyboards correctly (this was a problem with CM7 for a while as well). Every keyboard I can find is fixed, but I don't know how they achieved this.

The keyboard shows exactly how I would expect on the Emulator (screen width 480px), it's just on the device itself where it gets weird.

The code in the sample which appears to control the width of the IME is shown below, but even setting it to the explicit width of the screen resolution doesn't fix the problem.

/**
 * This is the point where you can do all of your UI initialization.  It
 * is called after creation and any configuration change.
 */
@Override public void onInitializeInterface() {
    if (mQwertyKeyboard != null) {
        // Configuration changes can happen after the keyboard gets recreated,
        // so we need to be able to re-build the keyboards if the available
        // space has changed.
        int displayWidth = getMaxWidth();
        if (displayWidth == mLastDisplayWidth) return;
        mLastDisplayWidth = displayWidth;
    }
    mQwertyKeyboard = new LatinKeyboard(this, R.xml.qwerty);
    mSymbolsKeyboard = new LatinKeyboard(this, R.xml.symbols);
    mSymbolsShiftedKeyboard = new LatinKeyboard(this, R.xml.symbols_shift);
}

EDIT: Found at least a temporary workaround, disabling compatibility mode renders the app properly... Not sure why this is necessary though, since the App is deployed using the correct API version (Gingerbread/10).

Was it helpful?

Solution

You need to set the sdk version in the Manifest file:

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top