资 源 简 介
This project illustrates an issue I had while working with drawables and screen orientation in Android. The sequence of steps to recreate the issue is:
Create an Activity with android:configChanges="orientation".
Create a layout portrait.xml which has one ImageView whose android:src attribute is set to some PNG image (in my case "@drawable/content")
Create a dummy layout landscape.xml that does nothing.
In onCreate(), use LayoutInflater to inflate the 2 layouts onto two separate views - mLandscape and mPortrait.
In onConfigurationChanged(), use setContentView() with the appropriate view passed in depending on orientation.
If you are in portrait mode, use setBounds() to "cut" the drawable (say, to half its height).