title: invalidate() not drawing my custom view
body: <p>SOLVED: Basically if you have a scrollview/horizontal view as a parent of your custom view, you must override onMeasure and specify the dimensions of your custom view so the parent scrollview knows how much room to allocate to it, and then it will draw.</p>
  
  <blockquote>
    <p>EDIT: I've found out that the problem is because I am trying to add a
    line to a relative layout which is wrapped in a scrollview. When I
    remove the scrollview the line is added correctly. I'm not sure why..
    but I need the scrollview in my app.. any ideas why this is the case
    would be appreciated, thanks!</p>
  </blockquote>
  
  <p>I'm trying to draw a line between two views I have, however it is not working, onDraw is not being called.</p>
  
  <blockquote>
  <pre><code>my custom view class:
  </code></pre>
  </blockquote>
  
  <pre><code>public class DrawLine extends View {
      Paint paint;
      Idea idea;
      IdeaVector ideaStartConnector;
      IdeaVector ideaStopConnector;
      Context mContext;
  
  
      public DrawLine(Context context,Idea idea) {
          super(context);
          this.idea = idea;
          this.mContext = context;
  </code></pre>
  
  <blockquote>
    <p>// these just define starting and stopping points between the middle
    of two seperate custom views I have.</p>
  </blockquote>
  
  <pre><code>        Idea stopConnectorIdea = IdeaTreeActivity.ideas.get(IdeaTreeActivity.ideas.size()-1);
  
          ideaStartConnector= new IdeaVector(idea.topLeftVector.x + idea.getWidth()/2,idea.topLeftVector.y+
                  idea.getHeight()/2,mContext);
          ideaStopConnector = new IdeaVector(stopConnectorIdea.topLeftVector.x +
                  stopConnectorIdea.getWidth()/2,stopConnectorIdea.topLeftVector.y+stopConnectorIdea
                  .getHeight()/2,mContext);
          paint = new Paint();
          paint.setColor(Color.GREEN);
      }
  
  
  
  
      protected void onDraw(Canvas canvas) {
          Log.i("drawLine", "response");
          canvas.drawLine(ideaStartConnector.x,ideaStartConnector.y,ideaStopConnector.x,ideaStopConnector.y,paint);
      }
  }
  </code></pre>
  
  <blockquote>
  <pre><code>my main activity:
  </code></pre>
  </blockquote>
  
  <pre><code>  public void addIdeaToLayout(){
                  rl.addView(idea, params); //rl is my relative layout
                  DrawLine connectingLine = new DrawLine(this,idea);
                  connectingLine.setWillNotDraw(false);
                  rl.addView(connectingLine);
                  connectingLine.invalidate();
  
          }
  </code></pre>
  
  <blockquote>
    <p>debug:</p>
    
    <p>Not sure if this is helpful, this is the response to my drag and drop
    event of one of the views, I basically want a line connected between
    the new view that has been dropped and the old view:</p>
  </blockquote>
  
  <p>06-18 08:39:03.131 4568-4568/? E/ScrollView: Invalid pointerId=-1 in onTouchEvent
  06-18 08:39:04.784 1298-2004/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x933 imply creation of host color buffer</p>
  
  <pre><code>                                             [ 06-18 08:39:04.786  4568: 4568 D/         ]
                                               HostConnection::get() New Host Connection established 0x915c9140, tid 4568
  </code></pre>
  
  <p>06-18 08:39:07.055 4568-4568/? I/ViewRootImpl[IdeaTreeActivity]: Reporting drop result: true
  06-18 08:39:07.058 4568-4568/? D/gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
  06-18 08:39:07.058 1621-1648/? W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.</p>