package com.arun;
import android.app.Activity;
import android.os.Bundle;
import java.security.PublicKey;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.ImageView;
public class Rotation extends Activity implements Button.OnClickListener
{
private ImageView img;
private Button btn1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn1=(Button)findViewById(R.id.button2);
btn1.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
img=(ImageView)findViewById(R.id.ImageView01);
Bitmap RBMP1 = BitmapFactory.decodeResource(getResources(), R.drawable.needle);
int w1 = RBMP1.getWidth();
int h1 = RBMP1.getHeight();
// Setting post rotate to 90
Matrix mtx1 = new Matrix();
mtx1.postRotate(45开发者_JS百科);
// Rotating Bitmap
Bitmap BMP1 = Bitmap.createBitmap(RBMP1, 0, 0, w1, h1, mtx1, true);
BitmapDrawable bmd1 = new BitmapDrawable(BMP1);
img.setImageDrawable(bmd1);
}
}
how to rotate image from the fixed point in android with out touch event
package com.arun;
import android.app.Activity;
import android.os.Bundle;
import java.security.PublicKey;
0
0
0
精彩评论