title: Custom view in android is looking different in every devices
body: <p>I am developing custom view in android. I wants to display path in the view. All the point are hard coded like this.</p>
  
  <pre><code>  private void loadData(){
                  float density = getResources().getDisplayMetrics().density;
                  testPath = new Path();
                  testPath.moveTo(new Point((int) (242*density), (int) (213*density)));
                  testPath.lineTo(new Point((int) (214*density), (int) (209*density)));
                  testPath.lineTo(new Point((int) (131*density), (int) (243*density)));
                  testPath.lineTo(new Point((int) (96*density), (int) (314*density)));
                  testPath.lineTo(new Point((int) (117*density), (int) (403*density)));
                  testPath.lineTo(new Point((int) (194*density), (int) (457*density)));
   }
  
  
  @Override
  protected void onDraw(Canvas canvas) {
          super.onDraw(canvas);{
          canvas.drawLine(0,200,canvas.getWidth(),200,drawPaint);
          canvas.drawLine(0,canvas.getHeight()/2,canvas.getWidth(),canvas.getHeight()/2,drawPaint);
          canvas.drawLine(canvas.getWidth()/2,0,canvas.getWidth()/2,canvas.getHeight(),drawPaint);
          canvas.drawPath(testPath, drawPaint);
  } 
  </code></pre>
  
  <p>But In xxhdpi screen is coming below the base line(middle line). while In the mpdpi its coming above the base line. If I don't multiply points with denisty pixel then path is too small in xxhdpidevices.
  Here is mdpi device image.<a href="https://i.stack.imgur.com/sH4FM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sH4FM.png" alt="enter image description here"></a>
  Here is xxhdpi device  <a href="https://i.stack.imgur.com/sH4FM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AIodl.png" alt="enter image description here"></a></p>