下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
图像旋转的基本思想是通过Matrix类的setRotate方法设置旋转的角度,然后使用Bitmap.createBitmap方法创建一个已经旋转了的图像。除此之外,还可以使用Canvas.setMatrix方法设置,并直接使用drawBitmap绘制。
public class MainActivity extends Activity{
public static int alpha=100;
private View myView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new MyView(this));
}
private class MyView extends View{
//十字扳手图像
private Bitmap bitmap1;
//小球图像
private Bitmap bitmap2;
//十字扳手当前角度
private int digree1 = 0;
//小球当前角度
private int digree2 = 360;
public MyView(Context context)
{
super(context);
setBackgroundColor(color.white);
InputStream