@ Override public void draw ( Canvas canvas ) { float width = canvas . getWidth ( ) ; float margin = ( width / 3 ) + mState . mMarginSide ; float posY = canvas . getHeight ( ) - mState . mMarginBottom ; canvas . drawLine ( margin , posY , width - margin , posY , mPaint ) ; }
It is based on the canvas width and height instead of the bounds in order not to consider the margins of the button it is drawn in .