Pregunta

I use adjustPan to automatically pan my application to make the EditText field visible when the softkeyboard appears. So far this has worked well but in the latest Android 4.4 Kitkat versions the actionbar pans up as usual but a white box is left behind. I've tried debugging this with the Eclipse View Hierarchy tool but it ignores the box. I've also experimented with v19 styling with no luck. This happens on a variety of Kitkat Nexus devices and emulators.

I'm happy to leave the actionbar on screen or remove it completely when the windows pans. Any help would be appreciated removing the box.

enter image description here

¿Fue útil?

Solución

I found that this only happens with the applications hardware acceleration is set to true in the manifest file.

I want to keep the hardware acceleration turned on so I wrote this snippet inside my onCreate method to turn it off just the action bar container.

    if(Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
        Resources res = Resources.getSystem();
        int id = res.getIdentifier("action_bar_overlay_layout", "id", "android");
        ViewGroup overlayLayout = (ViewGroup) this.findViewById(id);
        overlayLayout.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

UPDATE

This issue has been fixed in Android L preview API 20. Please note that the above code will cause an exception in Android L and so the version condition needs to be explicit to Kitkat.

    if(Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top