title: How to set drawable on background of View? Android
body: <p>I have next code in my custom view that extends EditText:</p>
  
  <pre><code>protected void onDraw(Canvas canvas) {
      super.onDraw(canvas);
  
                  int count = getLineCount();
                  Canvas cvs= new Canvas();
                  Drawable dr = this.getBackground();
                  Rect r = mRect;
                  Paint paint = mPaint;
                  mTextPaint.setTextSize(this.getTextSize());
                  Paint PaintText = mTextPaint;
  
                  for (int i = 0; i &lt; count; i++) {
                      int baseline = getLineBounds(i, r);
                      cvs.drawText(Integer.toString(i+1), r.left, baseline + 1, PaintText);
                      cvs.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint); 
                  }
                  cvs.drawLine(PaintText.measureText(Integer.toString(count)), this.getTop(), PaintText.measureText(Integer.toString(count)), this.getBottom(), paint);
                  dr.setBounds(0, 0, this.getRight(), this.getBottom());
                  dr.draw(cvs);
                  this.setBackgroundDrawable(dr);
              }
  </code></pre>
  
  <p>Why is there nothing on backgroind of this view?</p>