On Sep 27, 6:02 pm, Adam Lichwierowicz <[email protected]>
wrote:
> Than please advice when exactly (or where in the code to be precise)
> is this moment - since in all of the listeners I have mentioned, the
> Matrix did not gave correct points - the points where the same as if
> the imageview was not rescaled at all. So I.e. Input point 110,50
> (correct on original unscaled bitmap)- output points 110,50 (incorrect
> on the screen)
>
but better idea is what Kostya suggested: custom ViewGroup, like this:
public class ILayout extends FrameLayout {
private Button mButton;
private ImageView mImageView;
public ILayout(Context context, AttributeSet attrs) {
super(context, attrs);
mImageView = new ImageView(context);
mImageView.setImageResource(R.drawable.test);
addView(mImageView);
mButton = new Button(context);
addView(mButton);
}
@Override
protected void onLayout(boolean changed, int left, int top, int
right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
float[] pts = {
1, 1, 4, 4
};
mImageView.getImageMatrix().mapPoints(pts);
mButton.layout((int) pts[0], (int) pts[1], (int) pts[2], (int)
pts[3]);
}
}
here we have an ImageView displaying 5x5 test.png image and a button
which should appear scaled and translated in the centre of ImageView's
image
pskink
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en