T3Activity.java

package t3.com;import android.app.Activity;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.graphics.Matrix;import android.graphics.drawable.BitmapDrawable;import android.os.Bundle;import android.widget.ImageView;public class T3Activity extends Activity {    /** Called when the activity is first created. */private ImageView iv;    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.main);        iv = (ImageView)findViewById(R.id.iv);                Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),                 R.drawable.t);        int width = bitmapOrg.getWidth();         int height = bitmapOrg.getHeight();                 // 创建操作图片用的matrix对象        Matrix matrix =  new Matrix();        matrix.postRotate(270);//旋转度数                 Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,                 width, height, matrix, true);         BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);         iv.setImageDrawable(bmd);            }  //\\}

main.xml

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" ><RelativeLayout     android:layout_width="fill_parent"    android:layout_height="wrap_content"    > <ImageView      android:id="@+id/iv"        android:layout_width="wrap_content"        android:layout_centerInParent="true"        android:layout_height="wrap_content"        android:background="@android:color/transparent"            /></RelativeLayout></LinearLayout>

更多相关文章

  1. Android Binder进程间通信-ServiceManager代理对象的获取过程
  2. Android中如何使用Intent在Activity之间传递对象[使用Serializab
  3. Android Activity之间传递类对象
  4. 3-14 servlet 传出对象给 Android
  5. android 对象保存到SP
  6. android TabHost 对象报错
  7. Android wifi的WifiInfo对象详解
  8. Android之JAVASe基础篇-面向对象-IO(九)

随机推荐

  1. 常用的函数类型和常用的数据类型
  2. 留言板与自动客服
  3. javascript-基础(四)实战
  4. javascript-基础(三)
  5. Dom实战:留言板
  6. java tapestry5 布局 参数的处理
  7. JSP 传递中文参数的例子
  8. php实现JWT验证的实例教程
  9. PHP快速导出百万级数据到CSV或者EXCEL文
  10. 函数参数与返回值 、模板字面量及模板函