Java Code Examples for android.view.View.getLeft()

The following are Jave code examples for showing how to use getLeft() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Android_Songshuhui   File: SegmentTabLayout.java   Source Code and License Vote up 7 votes
private void calcOffset() {
        final View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
        mCurrentP.left = currentTabView.getLeft();
        mCurrentP.right = currentTabView.getRight();

        final View lastTabView = mTabsContainer.getChildAt(this.mLastTab);
        mLastP.left = lastTabView.getLeft();
        mLastP.right = lastTabView.getRight();

//        Log.d("AAA", "mLastP--->" + mLastP.left + "&" + mLastP.right);
//        Log.d("AAA", "mCurrentP--->" + mCurrentP.left + "&" + mCurrentP.right);
        if (mLastP.left == mCurrentP.left && mLastP.right == mCurrentP.right) {
            invalidate();
        } else {
            mValueAnimator.setObjectValues(mLastP, mCurrentP);
            if (mIndicatorBounceEnable) {
                mValueAnimator.setInterpolator(mInterpolator);
            }

            if (mIndicatorAnimDuration < 0) {
                mIndicatorAnimDuration = mIndicatorBounceEnable ? 500 : 250;
            }
            mValueAnimator.setDuration(mIndicatorAnimDuration);
            mValueAnimator.start();
        }
    }
 
Example 2
Project: WeatherStream   File: CustomViewBehind.java   Source Code and License Vote up 7 votes
public void drawShadow(View content, Canvas canvas) {
	if (mShadowDrawable == null || mShadowWidth <= 0) return;
	int left = 0;
	if (mMode == SlidingMenu.LEFT) {
		left = content.getLeft() - mShadowWidth;
	} else if (mMode == SlidingMenu.RIGHT) {
		left = content.getRight();
	} else if (mMode == SlidingMenu.LEFT_RIGHT) {
		if (mSecondaryShadowDrawable != null) {
			left = content.getRight();
			mSecondaryShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
			mSecondaryShadowDrawable.draw(canvas);
		}
		left = content.getLeft() - mShadowWidth;
	}
	mShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
	mShadowDrawable.draw(canvas);
}
 
Example 3
Project: UltimateRecyclerView   File: StickyHeaderDecoration.java   Source Code and License Vote up 7 votes
/**
 * {@inheritDoc}
 */
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    final int count = parent.getChildCount();

    for (int layoutPos = 0; layoutPos < count; layoutPos++) {
        final View child = parent.getChildAt(layoutPos);

        final int adapterPos = parent.getChildAdapterPosition(child);

        if (adapterPos != RecyclerView.NO_POSITION && (layoutPos == 0 || hasHeader(adapterPos))) {
            View header = getHeader(parent, adapterPos).itemView;
            c.save();
            final int left = child.getLeft();
            final int top = getHeaderTop(parent, child, header, adapterPos, layoutPos);
            c.translate(left, top);
            header.setTranslationX(left);
            header.setTranslationY(top);
            header.draw(c);
            c.restore();
        }
    }
}
 
Example 4
Project: boohee_v5.6   File: SlidingPaneLayout.java   Source Code and License Vote up 7 votes
public void draw(Canvas c) {
    Drawable shadowDrawable;
    super.draw(c);
    if (isLayoutRtlSupport()) {
        shadowDrawable = this.mShadowDrawableRight;
    } else {
        shadowDrawable = this.mShadowDrawableLeft;
    }
    View shadowView = getChildCount() > 1 ? getChildAt(1) : null;
    if (shadowView != null && shadowDrawable != null) {
        int left;
        int right;
        int top = shadowView.getTop();
        int bottom = shadowView.getBottom();
        int shadowWidth = shadowDrawable.getIntrinsicWidth();
        if (isLayoutRtlSupport()) {
            left = shadowView.getRight();
            right = left + shadowWidth;
        } else {
            right = shadowView.getLeft();
            left = right - shadowWidth;
        }
        shadowDrawable.setBounds(left, top, right, bottom);
        shadowDrawable.draw(c);
    }
}
 
Example 5
Project: SunmiUI   File: PagerSlidingTabStrip.java   Source Code and License Vote up 7 votes
private void scrollToChild(int position, int offset) {

        if (tabCount == 0) {
            return;
        }

        // lee.sz {
        View v = tabsContainer.getChildAt(position);
        int newScrollX = v.getLeft() + offset;

        if (position > 0 || offset > 0) {
            scrollOffset = (getWidth() / 2) - (v.getWidth() / 2);
            newScrollX -= scrollOffset;
        }
        // lee.sz }

        if (newScrollX != lastScrollX) {
            lastScrollX = newScrollX;
            scrollTo(newScrollX, 0);
        }

    }
 
Example 6
Project: DMS   File: CalendarView.java   Source Code and License Vote up 7 votes
/**
 * Tests scroll ability within child views of v given a delta of dx.
 *
 * @param v      View to test for horizontal scroll ability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx     Delta scrolled in pixels
 * @param x      X coordinate of the active touch point
 * @param y      Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance first.
        for (int i = count - 1; i >= 0; i--) {
            // This will not work for transformed views in Honeycomb+
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&
                    y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&
                    canScroll(child, true, dx, x + scrollX - child.getLeft(),
                            y + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
 
Example 7
Project: Andzu   File: BubblesLayoutCoordinator.java   Source Code and License Vote up 7 votes
private boolean checkIfBubbleIsOverTrash(BubbleLayout bubble) {
    boolean result = false;
    if (trashView.getVisibility() == View.VISIBLE) {
        View trashContentView = getTrashContent();
        int trashWidth = trashContentView.getMeasuredWidth();
        int trashHeight = trashContentView.getMeasuredHeight();
        int trashLeft = (trashContentView.getLeft() - (trashWidth / 2));
        int trashRight = (trashContentView.getLeft() + trashWidth + (trashWidth / 2));
        int trashTop = (trashContentView.getTop() - (trashHeight / 2));
        int trashBottom = (trashContentView.getTop() + trashHeight + (trashHeight / 2));
        int bubbleWidth = bubble.getMeasuredWidth();
        int bubbleHeight = bubble.getMeasuredHeight();
        int bubbleLeft = bubble.getViewParams().x;
        int bubbleRight = bubbleLeft + bubbleWidth;
        int bubbleTop = bubble.getViewParams().y;
        int bubbleBottom = bubbleTop + bubbleHeight;
        if (bubbleLeft >= trashLeft && bubbleRight <= trashRight) {
            if (bubbleTop >= trashTop && bubbleBottom <= trashBottom) {
                result = true;
            }
        }
    }
    return result;
}
 
Example 8
Project: iosched-reader   File: SlidingUpPanelLayout.java   Source Code and License Vote up 7 votes
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx Delta scrolled in pixels
 * @param x X coordinate of the active touch point
 * @param y Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance first.
        for (int i = count - 1; i >= 0; i--) {
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&
                    y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&
                    canScroll(child, true, dx, x + scrollX - child.getLeft(),
                            y + scrollY - child.getTop())) {
                return true;
            }
        }
    }
    return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
 
Example 9
Project: MDWechat   File: SegmentTabLayout.java   Source Code and License Vote up 7 votes
private void calcOffset() {
        final View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
        mCurrentP.left = currentTabView.getLeft();
        mCurrentP.right = currentTabView.getRight();

        final View lastTabView = mTabsContainer.getChildAt(this.mLastTab);
        mLastP.left = lastTabView.getLeft();
        mLastP.right = lastTabView.getRight();

//        Log.d("AAA", "mLastP--->" + mLastP.left + "&" + mLastP.right);
//        Log.d("AAA", "mCurrentP--->" + mCurrentP.left + "&" + mCurrentP.right);
        if (mLastP.left == mCurrentP.left && mLastP.right == mCurrentP.right) {
            invalidate();
        } else {
            mValueAnimator.setObjectValues(mLastP, mCurrentP);
            if (mIndicatorBounceEnable) {
                mValueAnimator.setInterpolator(mInterpolator);
            }

            if (mIndicatorAnimDuration < 0) {
                mIndicatorAnimDuration = mIndicatorBounceEnable ? 500 : 250;
            }
            mValueAnimator.setDuration(mIndicatorAnimDuration);
            mValueAnimator.start();
        }
    }
 
Example 10
Project: SmartChart   File: Utils.java   Source Code and License Vote up 6 votes
static int getEnd(View v, boolean withoutPadding) {
  if (v == null) {
    return 0;
  }
  if (isLayoutRtl(v)) {
    return (withoutPadding) ? v.getLeft() + getPaddingEnd(v) : v.getLeft();
  } else {
    return (withoutPadding) ? v.getRight() - getPaddingEnd(v) : v.getRight();
  }
}
 
Example 11
Project: LiuAGeAndroid   File: CustomViewBehind.java   Source Code and License Vote up 6 votes
public int getAbsLeftBound(View content) {
	if (mMode == SlidingMenu.LEFT || mMode == SlidingMenu.LEFT_RIGHT) {
		return content.getLeft() - getBehindWidth();
	} else if (mMode == SlidingMenu.RIGHT) {
		return content.getLeft();
	}
	return 0;
}
 
Example 12
Project: boohee_v5.6   File: ListPopupWindow.java   Source Code and License Vote up 6 votes
private void setPressedItem(View child, int position, float x, float y) {
    this.mDrawsInPressedState = true;
    if (VERSION.SDK_INT >= 21) {
        drawableHotspotChanged(x, y);
    }
    if (!isPressed()) {
        setPressed(true);
    }
    layoutChildren();
    if (this.mMotionPosition != -1) {
        View motionView = getChildAt(this.mMotionPosition - getFirstVisiblePosition());
        if (!(motionView == null || motionView == child || !motionView.isPressed())) {
            motionView.setPressed(false);
        }
    }
    this.mMotionPosition = position;
    float childX = x - ((float) child.getLeft());
    float childY = y - ((float) child.getTop());
    if (VERSION.SDK_INT >= 21) {
        child.drawableHotspotChanged(childX, childY);
    }
    if (!child.isPressed()) {
        child.setPressed(true);
    }
    positionSelectorLikeTouchCompat(position, child, x, y);
    setSelectorEnabled(false);
    refreshDrawableState();
}
 
Example 13
Project: Expert-Android-Programming   File: BrowseNearbyActivity.java   Source Code and License Vote up 5 votes
private int getRelativeLeft(View myView) {
    if (myView.getParent() == myView.getRootView())
        return myView.getLeft();
    else
        return myView.getLeft() + getRelativeLeft((View) myView.getParent());
}
 
Example 14
Project: NeiHanDuanZiTV   File: SlidingTabLayout.java   Source Code and License Vote up 5 votes
private void calcIndicatorRect() {
    View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
    float left = currentTabView.getLeft();
    float right = currentTabView.getRight();

    //for mIndicatorWidthEqualTitle
    if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
        TextView tab_title = (TextView) currentTabView.findViewById(R.id.tv_tab_title);
        mTextPaint.setTextSize(mTextsize);
        float textWidth = mTextPaint.measureText(tab_title.getText().toString());
        margin = (right - left - textWidth) / 2;
    }

    if (this.mCurrentTab < mTabCount - 1) {
        View nextTabView = mTabsContainer.getChildAt(this.mCurrentTab + 1);
        float nextTabLeft = nextTabView.getLeft();
        float nextTabRight = nextTabView.getRight();

        left = left + mCurrentPositionOffset * (nextTabLeft - left);
        right = right + mCurrentPositionOffset * (nextTabRight - right);

        //for mIndicatorWidthEqualTitle
        if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
            TextView next_tab_title = (TextView) nextTabView.findViewById(R.id.tv_tab_title);
            mTextPaint.setTextSize(mTextsize);
            float nextTextWidth = mTextPaint.measureText(next_tab_title.getText().toString());
            float nextMargin = (nextTabRight - nextTabLeft - nextTextWidth) / 2;
            margin = margin + mCurrentPositionOffset * (nextMargin - margin);
        }
    }

    mIndicatorRect.left = (int) left;
    mIndicatorRect.right = (int) right;
    //for mIndicatorWidthEqualTitle
    if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
        mIndicatorRect.left = (int) (left + margin - 1);
        mIndicatorRect.right = (int) (right - margin - 1);
    }

    mTabRect.left = (int) left;
    mTabRect.right = (int) right;

    if (mIndicatorWidth < 0) {   //indicatorWidth小于0时,原jpardogo's PagerSlidingTabStrip

    } else {//indicatorWidth大于0时,圆角矩形以及三角形
        float indicatorLeft = currentTabView.getLeft() + (currentTabView.getWidth() - mIndicatorWidth) / 2;

        if (this.mCurrentTab < mTabCount - 1) {
            View nextTab = mTabsContainer.getChildAt(this.mCurrentTab + 1);
            indicatorLeft = indicatorLeft + mCurrentPositionOffset * (currentTabView.getWidth() / 2 + nextTab.getWidth() / 2);
        }

        mIndicatorRect.left = (int) indicatorLeft;
        mIndicatorRect.right = (int) (mIndicatorRect.left + mIndicatorWidth);
    }
}
 
Example 15
Project: BestPracticeApp   File: PointLayout.java   Source Code and License Vote up 5 votes
@Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        View view = getChildAt(0);
        float width = view.getWidth();
        float height = view.getHeight();
        int left1 = view.getLeft();
        int top1 = view.getTop();
        float w = left1+width / 2;
        float h = top1+height / 2;
        float x = left1 +view.getTranslationX()+ width / 2;
        float y = top1 +view.getTranslationY()+ height / 2;
        path.reset();


        //移动点
        canvas.drawCircle(x, y, RADIUS_MOVE, paint);


        double sqrt = Math.sqrt((x - w) * (x - w) + (y - h) * (y - h));


        if (sqrt >= DISTANCE || isLeave) {
            doLeave();
            return;
        }
        float p = (float) ((OUTLENGTH - sqrt) / OUTLENGTH);


        float radius = ORGINLENGTH * p;
        canvas.drawCircle(w, h, radius, paint);
//        Log.i(TAG, "draw: " + sqrt);
        double cose = (x - w) / sqrt;
        double sine = (y - h) / sqrt;


        double dy = RADIUS_MOVE * cose;
        double dx = RADIUS_MOVE * sine;
        double dy1 = radius * cose;
        double dx1 = radius * sine;


        float x1 = (float) (w - dx1);
        float y1 = (float) (h + dy1);

        float x4 = (float) (w + dx1);
        float y4 = (float) (h - dy1);


        float x2 = (float) (x - dx);
        float y2 = (float) (y + dy);

        float x3 = (float) (x + dx);
        float y3 = (float) (y - dy);


        float xx = w + (x - w) / 2;
        float yy = h + (y - h) / 2;

        path.moveTo(x1, y1);
        path.quadTo(xx, yy, x2, y2);

        path.lineTo(x3, y3);
        path.quadTo(xx, yy, x4, y4);
        path.close();

        canvas.drawPath(path, paint);

//        canvas.drawCircle(x1, y1, 15, paint1);
//        canvas.drawCircle(x2, y2, 15, paint1);
//        canvas.drawCircle(x3, y3, 15, paint2);
//        canvas.drawCircle(x4, y4, 15, paint2);
//        canvas.drawCircle(xx, yy, 15, paint2);
    }
 
Example 16
Project: AndroidUiKit   File: SlidingTabLayout.java   Source Code and License Vote up 5 votes
private void calcIndicatorRect() {
    View currentTabView = mTabsContainer.getChildAt(this.mCurrentTab);
    float left = currentTabView.getLeft();
    float right = currentTabView.getRight();

    //for mIndicatorWidthEqualTitle
    if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
        TextView tab_title = (TextView) currentTabView.findViewById(R.id.tv_tab_title);
        mTextPaint.setTextSize(mTextsize);
        float textWidth = mTextPaint.measureText(tab_title.getText().toString());
        margin = (right - left - textWidth) / 2;
    }

    if (this.mCurrentTab < mTabCount - 1) {
        View nextTabView = mTabsContainer.getChildAt(this.mCurrentTab + 1);
        float nextTabLeft = nextTabView.getLeft();
        float nextTabRight = nextTabView.getRight();

        left = left + mCurrentPositionOffset * (nextTabLeft - left);
        right = right + mCurrentPositionOffset * (nextTabRight - right);

        //for mIndicatorWidthEqualTitle
        if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
            TextView next_tab_title = (TextView) nextTabView.findViewById(R.id.tv_tab_title);
            mTextPaint.setTextSize(mTextsize);
            float nextTextWidth = mTextPaint.measureText(next_tab_title.getText().toString());
            float nextMargin = (nextTabRight - nextTabLeft - nextTextWidth) / 2;
            margin = margin + mCurrentPositionOffset * (nextMargin - margin);
        }
    }

    mIndicatorRect.left = (int) left;
    mIndicatorRect.right = (int) right;
    //for mIndicatorWidthEqualTitle
    if (mIndicatorStyle == STYLE_NORMAL && mIndicatorWidthEqualTitle) {
        mIndicatorRect.left = (int) (left + margin - 1);
        mIndicatorRect.right = (int) (right - margin - 1);
    }

    mTabRect.left = (int) left;
    mTabRect.right = (int) right;

    if (mIndicatorWidth < 0) {   //indicatorWidth小于0时,原jpardogo's PagerSlidingTabStrip

    } else {//indicatorWidth大于0时,圆角矩形以及三角形
        float indicatorLeft = currentTabView.getLeft() + (currentTabView.getWidth() - mIndicatorWidth) / 2;

        if (this.mCurrentTab < mTabCount - 1) {
            View nextTab = mTabsContainer.getChildAt(this.mCurrentTab + 1);
            indicatorLeft = indicatorLeft + mCurrentPositionOffset * (currentTabView.getWidth() / 2 + nextTab.getWidth() / 2);
        }

        mIndicatorRect.left = (int) indicatorLeft;
        mIndicatorRect.right = (int) (mIndicatorRect.left + mIndicatorWidth);
    }
}
 
Example 17
Project: Hello-Music-droid   File: DragSortRecycler.java   Source Code and License Vote up 5 votes
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
    debugLog("onInterceptTouchEvent");

    //if (e.getAction() == MotionEvent.ACTION_DOWN)
    {
        View itemView = rv.findChildViewUnder(e.getX(), e.getY());

        if (itemView == null)
            return false;

        boolean dragging = false;

        if ((dragHandleWidth > 0) && (e.getX() < dragHandleWidth)) {
            dragging = true;
        } else if (viewHandleId != -1) {
            //Find the handle in the list item
            View handleView = itemView.findViewById(viewHandleId);

            if (handleView == null) {
                Log.e(TAG, "The view ID " + viewHandleId + " was not found in the RecycleView item");
                return false;
            }

            //View should be visible to drag
            if (handleView.getVisibility() != View.VISIBLE) {
                return false;
            }

            //We need to find the relative position of the handle to the parent view
            //Then we can work out if the touch is within the handle
            int[] parentItemPos = new int[2];
            itemView.getLocationInWindow(parentItemPos);

            int[] handlePos = new int[2];
            handleView.getLocationInWindow(handlePos);

            int xRel = handlePos[0] - parentItemPos[0];
            int yRel = handlePos[1] - parentItemPos[1];

            Rect touchBounds = new Rect(itemView.getLeft() + xRel, itemView.getTop() + yRel,
                    itemView.getLeft() + xRel + handleView.getWidth(),
                    itemView.getTop() + yRel + handleView.getHeight()
            );

            if (touchBounds.contains((int) e.getX(), (int) e.getY()))
                dragging = true;

            debugLog("parentItemPos = " + parentItemPos[0] + " " + parentItemPos[1]);
            debugLog("handlePos = " + handlePos[0] + " " + handlePos[1]);
        }


        if (dragging) {
            debugLog("Started Drag");

            setIsDragging(true);

            floatingItem = createFloatingBitmap(itemView);

            fingerAnchorY = (int) e.getY();
            fingerOffsetInViewY = fingerAnchorY - itemView.getTop();
            fingerY = fingerAnchorY;

            selectedDragItemPos = rv.getChildLayoutPosition(itemView);
            debugLog("selectedDragItemPos = " + selectedDragItemPos);

            return true;
        }
    }
    return false;
}
 
Example 18
Project: JewelryUI   File: FabAnimator.java   Source Code and License Vote up 5 votes
int getCenterX(View view) {
    return view.getWidth() / 2 + view.getLeft();
}
 
Example 19
Project: SunmiUI   File: PagerSlidingTabStrip.java   Source Code and License Vote up 5 votes
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (isInEditMode() || tabCount == 0) {
        return;
    }

    final int height = getHeight();

    // draw indicator line

    rectPaint.setColor(indicatorColor);

    // default: line below current tab
    View currentTab = tabsContainer.getChildAt(currentPosition);
    float lineLeft = currentTab.getLeft();
    float lineRight = currentTab.getRight();

    // if there is an offset, start interpolating left and right coordinates between current and next tab
    if (currentPositionOffset > 0f && currentPosition < tabCount - 1) {

        View nextTab = tabsContainer.getChildAt(currentPosition + 1);
        final float nextTabLeft = nextTab.getLeft();
        final float nextTabRight = nextTab.getRight();

        lineLeft = (currentPositionOffset * nextTabLeft + (1f - currentPositionOffset) * lineLeft);
        lineRight = (currentPositionOffset * nextTabRight + (1f - currentPositionOffset) * lineRight);
    }

    canvas.drawRect(lineLeft, height - indicatorHeight, lineRight, height, rectPaint);

    // draw underline
    rectPaint.setColor(underlineColor);
    canvas.drawRect(0, height - underlineHeight, tabsContainer.getWidth(), height, rectPaint);

    // draw divider
    dividerPaint.setColor(dividerColor);
    for (int i = 0; i < tabCount - 1; i++) {
        View tab = tabsContainer.getChildAt(i);
        canvas.drawLine(tab.getRight(), dividerPadding, tab.getRight(), height - dividerPadding, dividerPaint);
    }
}
 
Example 20
Project: Phial   File: ExpandedView.java   Source Code and License Vote up 5 votes
private void setupArrowPosition(View target) {
    float cX = (target.getLeft() + target.getRight()) / 2f;
    arrow.setX(cX - arrow.getWidth() / 2f);
}