FROM:http://www.eoeandroid.com/thread-332174-1-1.html
如题。。 android2.2不支持setRotation和getRotation方法 这两个方法是View里面的方法,一个是设置旋转角度,一个是获取旋转角度。。。 在android3.0以上,是对的不报错。。。但是在android2.2就不行了//、、直接报错。。。求助啊。。。怎么让两个方法支持android2.2(API8)以上的啊 报这样的错误。。。java.lang.NoSuchMethodError: android.widget.TextView.setRotation
|
<span style="font-size:18px;">已经解决了。。stackoverflow上找到的方法。。。。
if (Build.VERSION.SDK_INT < 11) {
RotateAnimation animation = new RotateAnimation(progress, progress,Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f);
animation.setDuration(100);
animation.setFillAfter(true);
textView.startAnimation(animation);
} else {
textView.setRotation(progress);
}
如果想要获取设置的角度的话,自定义一个View。。。。。就OK啦、。。。。。</span>