Rotating ImageView in Android lt; API Level 11(Android中的旋转ImageView lt;API 级别 11)
问题描述
因此,在 API 级别 11 中,Google 引入了旋转 ImageView 的功能(是的,在他们将这种旋转的可能性引入 Animate 之后,是的,聪明的思维,是的!)
So in API Level 11 Google introduced the ability to rotate an ImageView (Yay, after they introduced the possibility to Animate such a rotation, yay smart thinking, yay!)
但是我应该如何使用例如旋转 ImageViewAPI 8 级?如上所述,我不能使用 setRotation().
But how should I go about to rotate an ImageView using e.g. API level 8? I can't use setRotation() as described above.
推荐答案
我从创建位图和旋转画布/矩阵开始,但这不是一个好的解决方案.如果满足条件,最后只是交换可绘制对象.我应该说这是一个 ExpandableListView 单元格在绘图时被重用.
I started with creating BitMap and rotating the canvas/matrix, however this was not a good solution. Finally ended up just swapping the drawable if conditions are met. I should say this is an ExpandableListView where cells are reused when drawing.
if (isExpanded) {
ImageView view = (ImageView) convertView.findViewById(R.id.ImageView);
view.setImageResource(R.drawable.quickactions_button_normal_down);
}
if (!isExpanded) {
ImageView view = (ImageView) convertView.findViewById(R.id.ImageView);
view.setImageResource(R.drawable.quickactions_button_normal);
}
我通常不是 Android 开发人员,但我真的很惊讶可以为旋转设置动画,但不能静态设置可绘制对象的旋转.从逻辑上讲,第一个是第二个的子集,而不是相反.
I'm not usually a Android developer but I'm really amazed that it is possible to animate a rotation, but not statically set the rotation of a drawable. Logically the first is a subset of the second and not the other way around.
这篇关于Android中的旋转ImageView <API 级别 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android中的旋转ImageView <API 级别 11
基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
