I tried implementing the code for zoom image using a matrix in
android. But am getting the below issue. Could someone please help me
out with this?

Here's the code:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView
        android:id="@+id/imageview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="matrix"
        android:src="@drawable/myimage" >
    </ImageView>

</FrameLayout>

public class MyActivity extends Activity{
Matrix matrix = new Matrix();
    Matrix savedMatrix = new Matrix();
    ImageView imageView;
@Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        imageView = (ImageView) findViewById(R.id.imageview);
        imageView.setScaleType(ScaleType.MATRIX);
        Bitmap cur_bm = BitmapFactory.decodeResource(getResources(),
                R.drawable.myimage);
        imageView.setImageBitmap(cur_bm);
    }
}

If I comment the line imageView.setScaleType(ScaleType.MATRIX); then
the image appears skewed in the emulator. It doesn't fill the screen.

But if I uncomment the line imageView.setScaleType(ScaleType.MATRIX);
then the image fills the screen of the emulator.

Just setting the scaleType to MATRIX causes the image to scale down.
Could someone tell why this happens and how to overcome this issue?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to