Skip to content Skip to sidebar Skip to footer

Drawables Pulled From Wrong Resource Folder On Rotation

Pulling my hair out here. So I'm working with an application that has several types of drawables, and I have them in a structure like so: res/ //Portrait resources drawable

Solution 1:

So I've figured out where the problem resides, and I'm honestly not sure if it's my misunderstanding or a bug in Android. I didn't think to add this as part of the question (looking back, I should have) but my drawable was a layer-list drawable with two images stacked atop each other (one shadow, one image above the shadow) :

<layer-listxmlns:android="http://schemas.android.com/apk/res/android>
    <item>
        <bitmap android:src="@drawable/shadow"/></item><item><bitmapandroid:src="@drawable/image"android:gravity="top|center_horizontal"/></item></layer-list>

It seems that this only gets parsed out once (I'm assuming for efficiency it's reused) but it never goes back and reconstructs the layer-list with the drawables for the new configuration.

I changed to using two aligned ImageViews instead of a layer-list drawable and all is well.

Post a Comment for "Drawables Pulled From Wrong Resource Folder On Rotation"