I using the following GradientDrawable as background for a RelativeLayout:
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="@integer/my_value"
android:endColor="#0FFF"
android:startColor="#FFFF" />
</shape>
Then created a file called integers.xml in the res\values folder:
<resources>
<integer name="my_value">90</integer>
</resources>
And another file with the same name under res\values-land folder:
<resources>
<integer name="my_value">180</integer>
</resources>
So when I rotate the device the gradient goes from bottom->top to right->left when running Android 2.3.3 (as expected) but when I test this on Android 4.4.4 the gradient angle does not change.
I've also tried with:
<item name="my_value" format="float" type="dimen">90</integer>
but same result.
Any ideas?
UPDATE:
The RelativeLayout that uses the GradientDrawable exists in 2 different files:
- res\layout\my_layout
- res\layout-land\my_layout
res\layout-land\my_layout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/my_drawable" >
UPDATE 2:
The problem happens only when rotating the device. If I start the activity with the device previously rotated then the gradient angle is properly set.