¿Qué pasó con windowContentOverlay en Android API 18?


Después de actualizar mi teléfono a Android 4.3 noté que la sombra debajo de la barra de acción ya no se muestra. En mi aplicación tengo una sombra personalizada usando windowContentOverlay:

<item name="android:windowContentOverlay">@drawable/shadows_bottom</item>

Siempre se ha estado mostrando, pero ahora se ha ido en API 18. Eliminar esa línea del tema no cambia nada. mientras que en otras versiones de API muestra una ligera sombra predeterminada.

¿Alguien más ha notado ese problema?

Author: Renjith, 2013-07-30

2 answers

Pude evitar este error de plataforma agregando el siguiente método a mi base FragmentActivity y llamándolo onCreate después de que el diseño se haya inflado:

/**
 * Set the window content overlay on device's that don't respect the theme
 * attribute.
 */
private void setWindowContentOverlayCompat() {
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR2) {
        // Get the content view
        View contentView = findViewById(android.R.id.content);

        // Make sure it's a valid instance of a FrameLayout
        if (contentView instanceof FrameLayout) {
            TypedValue tv = new TypedValue();

            // Get the windowContentOverlay value of the current theme
            if (getTheme().resolveAttribute(
                    android.R.attr.windowContentOverlay, tv, true)) {

                // If it's a valid resource, set it as the foreground drawable
                // for the content view
                if (tv.resourceId != 0) {
                    ((FrameLayout) contentView).setForeground(
                            getResources().getDrawable(tv.resourceId));
                }
            }
        }
    }
}

Esto funciona muy bien porque no tiene que cambiar sus temas o agregar vistas dinámicamente a sus diseños. Debe ser compatible con forward y se puede eliminar fácilmente una vez que se haya corregido este error.

 30
Author: twaddington,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-07 03:01:16

Esto es oficialmente un error y se corregirá para la próxima versión de la plataforma: https://code.google.com/p/android/issues/detail?id=58280

ACTUALIZAR: Esto parece estar arreglado en el nivel de API 19

 17
Author: Romain Piel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-11-09 08:18:03