@@ -4863,6 +4863,13 @@ private Path getUpdatedHighlightPath() {
48634863 return highlight ;
48644864 }
48654865
4866+ /**
4867+ * @hide
4868+ */
4869+ public int getHorizontalOffsetForDrawables () {
4870+ return 0 ;
4871+ }
4872+
48664873 @ Override
48674874 protected void onDraw (Canvas canvas ) {
48684875 restartMarqueeIfNeeded ();
@@ -4880,6 +4887,10 @@ protected void onDraw(Canvas canvas) {
48804887 final int left = mLeft ;
48814888 final int bottom = mBottom ;
48824889 final int top = mTop ;
4890+ final boolean isLayoutRtl = isLayoutRtl ();
4891+ final int offset = getHorizontalOffsetForDrawables ();
4892+ final int leftOffset = isLayoutRtl ? 0 : offset ;
4893+ final int rightOffset = isLayoutRtl ? offset : 0 ;
48834894
48844895 final Drawables dr = mDrawables ;
48854896 if (dr != null ) {
@@ -4895,7 +4906,7 @@ protected void onDraw(Canvas canvas) {
48954906 // Make sure to update invalidateDrawable() when changing this code.
48964907 if (dr .mDrawableLeft != null ) {
48974908 canvas .save ();
4898- canvas .translate (scrollX + mPaddingLeft ,
4909+ canvas .translate (scrollX + mPaddingLeft + leftOffset ,
48994910 scrollY + compoundPaddingTop +
49004911 (vspace - dr .mDrawableHeightLeft ) / 2 );
49014912 dr .mDrawableLeft .draw (canvas );
@@ -4906,7 +4917,8 @@ protected void onDraw(Canvas canvas) {
49064917 // Make sure to update invalidateDrawable() when changing this code.
49074918 if (dr .mDrawableRight != null ) {
49084919 canvas .save ();
4909- canvas .translate (scrollX + right - left - mPaddingRight - dr .mDrawableSizeRight ,
4920+ canvas .translate (scrollX + right - left - mPaddingRight
4921+ - dr .mDrawableSizeRight - rightOffset ,
49104922 scrollY + compoundPaddingTop + (vspace - dr .mDrawableHeightRight ) / 2 );
49114923 dr .mDrawableRight .draw (canvas );
49124924 canvas .restore ();
@@ -4991,8 +5003,6 @@ protected void onDraw(Canvas canvas) {
49915003 }
49925004 canvas .translate (compoundPaddingLeft , extendedPaddingTop + voffsetText );
49935005
4994- final boolean isLayoutRtl = isLayoutRtl ();
4995-
49965006 final int layoutDirection = getLayoutDirection ();
49975007 final int absoluteGravity = Gravity .getAbsoluteGravity (mGravity , layoutDirection );
49985008 if (mEllipsize == TextUtils .TruncateAt .MARQUEE &&
0 commit comments