While trying to find a solution for the layout that I want, I came across the setScaleX/setScaleY methods, which are members of the View class.
View class doc
Now looking at the methods of RelativeLayout and filtering by the API Level 8, since I'm developing an App for >= 2.2, the said methods fade out. But when looking at "Inherited XML Attributes From Class android.view.View" the properties android:scaleX/android:scaleY are still available. Unfortunately trying to use these properties doesn't work and Eclipse says: "error: No resource identifier found for attribute 'scaleX' in package 'android'"
RelativeLayout class doc
So it seems like the documentation is contradictory and scaleX/scaleY are not available until 3.0 or am I missing something?
NineOldAndroid
is deprecated according to it's github link NineOldAndroid
Use Android Support library
instead of NineOldAndroid
so you should use ViewCompat
instead of ViewHelper
simply change:
view.setScaleX(2);
or
ViewHelper.setScaleX(view,2);
to:
ViewCompat.setScaleX(view,2);
hope it helps
I met a similar problem when I tried to set the view with an initial scaleX value before playing any animations, however view.setScaleX() is since API Level 11 accroding to @Dr.J .
If you want to use the Honeycomb Animation API in earlier API Levels, do have a try with NineOldAndroids at http://nineoldandroids.com/ . Based on this opensource lib, there is a workaround to provide the view an initial scaleX.
ObjectAnimator.ofFloat(getMyButton(), "scaleX", 1f, 0f).setDuration(1).start();
Ok, it looks like this is a false representation in the docs, as it's explained here scaleX/scaleY are properties added to the View class with Honeycomb and therefore unfortunately not available in Froyo.
nope, the Docs are right:
public void setScaleX (float scaleX) Since: API Level 11
Froyo is API Level 8.
Use the com.nineoldandroids.view.ViewHelper
for older APIs:
ViewHelper.setScaleY(myButton, 0.01f);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With