title: Pinch Zooming on textview android
body: <p>Hello friend I have done pinch zoom textview and its work fine but the problem is when I zoom out the textview position changed and i want the position of textview is fixed during zoom in and zoom out that is my code </p>
  
  <pre><code>public class MainActivity extends Activity {
  
      TextView scaleGesture;
      ScaleGestureDetector scaleGestureDetector;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          scaleGesture = (TextView)findViewById(R.id.article);
          scaleGesture.setText("this is some text");
          scaleGestureDetector = new ScaleGestureDetector(this, new simpleOnScaleGestureListener());
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
  
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          // TODO Auto-generated method stub
          scaleGestureDetector.onTouchEvent(event);
          return true;
      }
  
      public class simpleOnScaleGestureListener extends
              SimpleOnScaleGestureListener {
  
          @Override
          public boolean onScale(ScaleGestureDetector detector) {
              // TODO Auto-generated method stub
              float size = scaleGesture.getTextSize();
              Log.d("TextSizeStart", String.valueOf(size));
  
              float factor = detector.getScaleFactor();
              Log.d("Factor", String.valueOf(factor));
  
  
              float product = size*factor;
              Log.d("TextSize", String.valueOf(product));
              scaleGesture.setTextSize(TypedValue.COMPLEX_UNIT_PX, product);
  
              size = scaleGesture.getTextSize();
              Log.d("TextSizeEnd", String.valueOf(size));
              return true;
          }
      }
  }
  </code></pre>