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
				
        
 
            
        基础教程推荐
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
 - Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
 - iOS - UINavigationController 添加多个正确的项目? 2022-01-01
 - Play 商店的设备兼容性问题 2022-01-01
 - navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
 - Android Volley - 如何动画图像加载? 2022-01-01
 - 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
 - UIImage 在开始时不适合 UIScrollView 2022-01-01
 - 如何将图像从一项活动发送到另一项活动? 2022-01-01
 - 如何比较两个 NSDate:哪个是最近的? 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
				
				
				
				