我有一个Bitmap对象,我要获得与该对象左右相反的Bitmap对象,不是上下颠倒,怎么办,求助。最好有代码。

解决方案 »

  1.   


    bitmap = BitmapFactory.decodeResource(getResources(),
    id);
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    Matrix matrix = new Matrix();
    matrix.setScale(-1.0f, 1.0f);
    bitmap.setDensity(160);
    bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height,
    matrix, true);
    BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap);不多说,直接上代码,自己之前写的。关键是这句
    matrix.setScale(-1.0f, 1.0f);
    这句是设置了密度  bitmap.setDensity(160);
    自己试试吧,绝对可以。
    给分吧 亲