Android2.2 不支持setRotation和getRotation方法

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>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值