0

So i've tried using this list-layer(window_background.xml) , with my theme:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <solid android:color="@color/background_grey" />
    </shape>
</item>
<item  android:top="60dp">

    <bitmap android:src="@drawable/logo_home_white_agora"
            android:gravity="center"/>
</item>

Theme:

<style name="Theme.CustomTheme" parent="android:Theme">

<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>

The problem is that using the list-layer doesn't seem redraw the background on configuration changes to use specific size image. Is there another way to do this?

Maxrunner
  • 1,955
  • 4
  • 24
  • 41
  • What do you meqan by "the list-layer doesn't seem redraw the background on configuration changes to use specific size image"? What is the expected result and what you have right now in `onConfigurationChange()` ? Paste some pictures so we can see. – g00dy Aug 07 '13 at 11:30
  • Well the problem is, if you launch the app in portrait mode, it will never re-render the image that is in the landscape mode which is smaller.Likewise if you launch in landscape mode and then rotate, it will not change the image. I just tested this yesterday.There was this thread here that somehow gave the same result: http://stackoverflow.com/questions/15983058/drawables-pulled-from-wrong-resource-folder-on-rotation – Maxrunner Aug 07 '13 at 14:59
  • ok, paste the code of the function, where you use `window_background.xml` or all the layouts. – g00dy Aug 07 '13 at 15:19
  • I don't use more code, i just use the method setTheme(themeId); on the onCreate method of all activities. All activities extend from a base one, this base activity has abstract method getThemeId() that all sub classes implement and then the method i refered apply the theme. Most of these activities just use the CustomTheme. – Maxrunner Aug 07 '13 at 15:25
  • Can you call `setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);` where the orientation does not redraw, just to see if the issue can be fixed with that? There's also a solution here for tis one -> http://stackoverflow.com/questions/2644377/changing-locale-force-activity-to-reload-resources – g00dy Aug 07 '13 at 15:53
  • Just created a new project and put two different images with same name , drawable-hdpi/mdpi/xhdpi...etc and drawable-land-hdpi/etc... and when i rotate the image stays the same. If you leave the app, and really close it and open it in portrait, it will always use the image in the default portrait folder even after you rotate. Now leave the app again and really close it. Open it in landscape and it will always use the landspace folder even after you rotate it. is this the normal behaviour? – Maxrunner Aug 07 '13 at 15:56
  • @g00dy just tried what you said in that thread but it didn't work. Now regardind setRequestedOrietantion method where do i call that? on the on onCreate? – Maxrunner Aug 07 '13 at 16:08
  • Hi, yes, put that in the onCreate. – g00dy Aug 07 '13 at 16:25

0 Answers0