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


- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- UITextView 内容插图 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- URL编码Swift iOS 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01