问题描述
因此,在API级别11谷歌推出来旋转ImageView的能力(耶,之后便推出动画这样的旋转,耶智能思维的可能性,耶!)
不过,我应该如何去旋转使用,例如一个ImageView的API级别8?我不能使用setRotation()如上述。
我开始创建位图和旋转画布/矩阵,但是这并不是一个很好的解决方案。终于结束了刚刚换了绘制,如果条件得到满足。我应该说这是在细胞绘画时重复使用的ExpandableListView。
如果(isExpanded){
ImageView的观点=(ImageView的)convertView.findViewById(R.id.ImageView);
view.setImageResource(R.drawable.quickactions_button_normal_down);
}
如果(!isExpanded){
ImageView的观点=(ImageView的)convertView.findViewById(R.id.ImageView);
view.setImageResource(R.drawable.quickactions_button_normal);
}
我不是通常是一个Android开发者,但我真的很惊讶,这是可能的动画旋转,而不是静态地设置绘制的旋转。逻辑上的第一个是第二,而不是周围的其他方式的一个子集
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!)
But how should I go about to rotate an ImageView using e.g. API level 8? I can't use setRotation() as described above.
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);
}
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.
这篇关于旋转的ImageView在Android的< API等级11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!