解决方法如下:
packages/apps/Launcher3
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -245,7 +245,13 @@ public abstract class ArrowPopup extends AbstractFloatingView {
int leftAlignedX = mTempRect.left;
int rightAlignedX = mTempRect.right - width;
int x = leftAlignedX;
- boolean canBeLeftAligned = leftAlignedX + width + insets.left
+ int iconWidth = mTempRect.width();
+ Resources resources = getResources();
+ int shortcutIconWidth = resources.getDimensionPixelSize(R.dimen.deep_shortcut_icon_size);
+ int shortcutPaddingStart = resources.getDimensionPixelSize(
+ R.dimen.popup_padding_start);
+ int xOffsetLeftStart = iconWidth / 2 - shortcutIconWidth / 2 - shortcutPaddingStart;
+ boolean canBeLeftAligned = leftAlignedX + width + insets.left + xOffsetLeftStart
< dragLayer.getRight() - insets.right;
boolean canBeRightAligned = rightAlignedX > dragLayer.getLeft() + insets.left;
if (!canBeLeftAligned || (mIsRtl && canBeRightAligned)) {
@@ -254,15 +260,10 @@ public abstract class ArrowPopup extends AbstractFloatingView {
mIsLeftAligned = x == leftAlignedX;
// Offset x so that the arrow and shortcut icons are center-aligned with the original icon.
- int iconWidth = mTempRect.width();
- Resources resources = getResources();
- int xOffset;
+ int xOffset;
if (isAlignedWithStart()) {
// Aligning with the shortcut icon.
- int shortcutIconWidth = resources.getDimensionPixelSize(R.dimen.deep_shortcut_icon_size);
- int shortcutPaddingStart = resources.getDimensionPixelSize(
- R.dimen.popup_padding_start);
- xOffset = iconWidth / 2 - shortcutIconWidth / 2 - shortcutPaddingStart;
+ xOffset = xOffsetLeftStart;
} else {
// Aligning with the drag handle.
int shortcutDragHandleWidth = resources.getDimensionPixelSize(