I create custom view.
public class ScaleGestureDetectorView extends View {I prepare image for Drawable. I prepare s093 named jpeg image.
int resid = context.getResources().getIdentifier("s093", "drawable", context.getPackageName()); Drawable mImage; mImage = context.getResources().getDrawable(resid); mImage.setBounds(0, 0, width, height );I prepare ScaleGestureDetector class.
mScaleGestureDetector = new ScaleGestureDetector(context, mSimpleListener);call onDraw() by invalidate().
public void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.save(); canvas.scale(mScaleFactor, mScaleFactor); mImage.draw(canvas); canvas.restore();input event to ScaleGestureDetector at onTouchEvent.
public boolean onTouchEvent(MotionEvent ev) { mScaleGestureDetector.onTouchEvent(ev); return true; }I prepare ScaleGestureDetector.SimpleOnScaleGestureListener
public void onScaleEnd(ScaleGestureDetector detector) { Log.d("ges", "onScaleEnd "+ detector.getScaleFactor()); mScaleFactor *= detector.getScaleFactor(); invalidate(); super.onScaleEnd(detector); }source code is here. Please suggest your android issue by twitter or mail, I would try to clear up your issue.
0 件のコメント:
コメントを投稿