@@ -326,7 +326,6 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom,
326326 int oldLeft , int oldTop , int oldRight , int oldBottom ) {
327327 adjustDropDownSizeAndPosition ();
328328 }
329-
330329 });
331330 }
332331
@@ -1285,15 +1284,22 @@ private void adjustDropDownSizeAndPosition() {
12851284 Resources res = getContext ().getResources ();
12861285 int anchorPadding = mSearchPlate .getPaddingLeft ();
12871286 Rect dropDownPadding = new Rect ();
1287+ final boolean isLayoutRtl = isLayoutRtl ();
12881288 int iconOffset = mIconifiedByDefault
12891289 ? res .getDimensionPixelSize (R .dimen .dropdownitem_icon_width )
12901290 + res .getDimensionPixelSize (R .dimen .dropdownitem_text_padding_left )
12911291 : 0 ;
12921292 mQueryTextView .getDropDownBackground ().getPadding (dropDownPadding );
1293- mQueryTextView .setDropDownHorizontalOffset (-(dropDownPadding .left + iconOffset )
1294- + anchorPadding );
1295- mQueryTextView .setDropDownWidth (mDropDownAnchor .getWidth () + dropDownPadding .left
1296- + dropDownPadding .right + iconOffset - (anchorPadding ));
1293+ int offset ;
1294+ if (isLayoutRtl ) {
1295+ offset = - dropDownPadding .left ;
1296+ } else {
1297+ offset = anchorPadding - (dropDownPadding .left + iconOffset );
1298+ }
1299+ mQueryTextView .setDropDownHorizontalOffset (offset );
1300+ final int width = mDropDownAnchor .getWidth () + dropDownPadding .left
1301+ + dropDownPadding .right + iconOffset - anchorPadding ;
1302+ mQueryTextView .setDropDownWidth (width );
12971303 }
12981304 }
12991305
@@ -1347,6 +1353,11 @@ public void onNothingSelected(AdapterView<?> parent) {
13471353 }
13481354 };
13491355
1356+ @ Override
1357+ public void onResolvedLayoutDirectionChanged () {
1358+ mQueryTextView .setLayoutDirection (getResolvedLayoutDirection ());
1359+ }
1360+
13501361 /**
13511362 * Query rewriting.
13521363 */
0 commit comments