Pull my hair here. Therefore, I work with an application with several types of drawings, and I have them in this structure:
res/ //Portrait resources drawable-mdpi/ drawable-hdpi/ drawable-xhdpi/ //Landscape resources drawable-land-mdpi/ drawable-land-hdpi/ drawable-land-xhdpi/
EDIT I also tried even putting portrait-highlighted drawings under drawable-port-mdpi , etc. with the same result.
And I have a custom View that I use to draw drawings at runtime. Here's an example, but I have a problem:
public class CustomView extends FrameLayout { private ImageView mBackgroundView; public CustomView (Context context) { super(context); initialize(); } public CustomView (Context context, AttributeSet attrs) { super(context, attrs); initialize(); } public CustomView (Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initialize(); } private void initialize () { mBackgroundView = new ImageView(getContext()); mBackgroundView.setImageResource(R.drawable.my_resource); addView(mBackgroundView, wrapContent()); } private LayoutParams wrapContent () { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } }
I would expect that when I turn to the landscape (and let me clarify first, I AM NOT handling configChanges in the manifest for this Activity ), and this View created, mBackgroundView should get drawable in drawable-land-xhdpi . Conversely, when I turn back, I should get drawable at drawable-xhdpi .
Now that is getting weird. I can confirm that the drawings are all there and found, because if I run the application in the landscape, I get the correct landscape with the ability to draw . However, during rotation, the landscape remains unchanged, and I do not get a portrait portrait. Conversely, if I run in a portrait, I am stuck with a portrait.
Is there some special case that I have to handle with the resources "or w70" or sometime when I capture them programmatically?