@@ -4734,6 +4734,13 @@ private Path getUpdatedHighlightPath() {
47344734 return highlight ;
47354735 }
47364736
4737+ /**
4738+ * @hide
4739+ */
4740+ public int getHorizontalOffsetForDrawables () {
4741+ return 0 ;
4742+ }
4743+
47374744 @ Override
47384745 protected void onDraw (Canvas canvas ) {
47394746 restartMarqueeIfNeeded ();
@@ -4751,6 +4758,10 @@ protected void onDraw(Canvas canvas) {
47514758 final int left = mLeft ;
47524759 final int bottom = mBottom ;
47534760 final int top = mTop ;
4761+ final boolean isLayoutRtl = isLayoutRtl ();
4762+ final int offset = getHorizontalOffsetForDrawables ();
4763+ final int leftOffset = isLayoutRtl ? 0 : offset ;
4764+ final int rightOffset = isLayoutRtl ? offset : 0 ;
47544765
47554766 final Drawables dr = mDrawables ;
47564767 if (dr != null ) {
@@ -4766,7 +4777,7 @@ protected void onDraw(Canvas canvas) {
47664777 // Make sure to update invalidateDrawable() when changing this code.
47674778 if (dr .mDrawableLeft != null ) {
47684779 canvas .save ();
4769- canvas .translate (scrollX + mPaddingLeft ,
4780+ canvas .translate (scrollX + mPaddingLeft + leftOffset ,
47704781 scrollY + compoundPaddingTop +
47714782 (vspace - dr .mDrawableHeightLeft ) / 2 );
47724783 dr .mDrawableLeft .draw (canvas );
@@ -4777,7 +4788,8 @@ protected void onDraw(Canvas canvas) {
47774788 // Make sure to update invalidateDrawable() when changing this code.
47784789 if (dr .mDrawableRight != null ) {
47794790 canvas .save ();
4780- canvas .translate (scrollX + right - left - mPaddingRight - dr .mDrawableSizeRight ,
4791+ canvas .translate (scrollX + right - left - mPaddingRight
4792+ - dr .mDrawableSizeRight - rightOffset ,
47814793 scrollY + compoundPaddingTop + (vspace - dr .mDrawableHeightRight ) / 2 );
47824794 dr .mDrawableRight .draw (canvas );
47834795 canvas .restore ();
@@ -4862,8 +4874,6 @@ protected void onDraw(Canvas canvas) {
48624874 }
48634875 canvas .translate (compoundPaddingLeft , extendedPaddingTop + voffsetText );
48644876
4865- final boolean isLayoutRtl = isLayoutRtl ();
4866-
48674877 final int layoutDirection = getLayoutDirection ();
48684878 final int absoluteGravity = Gravity .getAbsoluteGravity (mGravity , layoutDirection );
48694879 if (mEllipsize == TextUtils .TruncateAt .MARQUEE &&
0 commit comments