当前位置: 首页>>代码示例>>Java>>正文


Java ViewGroup.getLeft方法代码示例

本文整理汇总了Java中android.view.ViewGroup.getLeft方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.getLeft方法的具体用法?Java ViewGroup.getLeft怎么用?Java ViewGroup.getLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.getLeft方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: alignWithIconView

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * Aligns the shadow with {@param view}
 * @param viewParent immediate parent of {@param view}. It must be a sibling of this view.
 */
public void alignWithIconView(BubbleTextView view, ViewGroup viewParent, View clipAgainstView) {
    float leftShift = view.getLeft() + viewParent.getLeft() - getLeft();
    float topShift = view.getTop() + viewParent.getTop() - getTop();
    int iconWidth = view.getRight() - view.getLeft();
    int iconHeight = view.getBottom() - view.getTop();
    int iconHSpace = iconWidth - view.getCompoundPaddingRight() - view.getCompoundPaddingLeft();
    float drawableWidth = view.getIcon().getBounds().width();

    if (clipAgainstView != null) {
        // Set the bounds to clip against
        int[] coords = new int[] {0, 0};
        Utilities.getDescendantCoordRelativeToAncestor(clipAgainstView, (View) getParent(),
                coords, false);
        int clipLeft = (int) Math.max(0, coords[0] - leftShift - mShadowPadding);
        int clipTop = (int) Math.max(0, coords[1] - topShift - mShadowPadding) ;
        setClipBounds(new Rect(clipLeft, clipTop, clipLeft + iconWidth, clipTop + iconHeight));
    } else {
        // Reset the clip bounds
        setClipBounds(null);
    }

    setTranslationX(leftShift
            + viewParent.getTranslationX()
            + view.getCompoundPaddingLeft() * view.getScaleX()
            + (iconHSpace - drawableWidth) * view.getScaleX() / 2  /* drawable gap */
            + iconWidth * (1 - view.getScaleX()) / 2  /* gap due to scale */
            - mShadowPadding  /* extra shadow size */
            );
    setTranslationY(topShift
            + viewParent.getTranslationY()
            + view.getPaddingTop() * view.getScaleY()  /* drawable gap */
            + view.getHeight() * (1 - view.getScaleY()) / 2  /* gap due to scale */
            - mShadowPadding  /* extra shadow size */
            );
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:40,代码来源:ClickShadowView.java

示例2: prepare

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
    ViewGroup parent = (ViewGroup) target.getParent();
    int distance = parent.getWidth() - parent.getLeft();
    animatorSet.playTogether(
            ObjectAnimator.ofFloat(target, "alpha", 1, 1, 0),
            ObjectAnimator.ofFloat(target, "scaleX", 1, 0.475f, 0.1f),
            ObjectAnimator.ofFloat(target, "scaleY", 1, 0.475f, 0.1f),
            ObjectAnimator.ofFloat(target, "translationX", 0, -42, distance)
    );
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:12,代码来源:ZoomOutRightAnimatorDecoration.java

示例3: prepare

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void prepare(View target) {
    ViewGroup parent = (ViewGroup) target.getParent();
    int distance = parent.getWidth() - parent.getLeft();
    getAnimatorAgent().playTogether(
            ObjectAnimator.ofFloat(target, "alpha", 1, 1, 0),
            ObjectAnimator.ofFloat(target, "scaleX", 1, 0.475f, 0.1f),
            ObjectAnimator.ofFloat(target, "scaleY", 1, 0.475f, 0.1f),
            ObjectAnimator.ofFloat(target, "translationX", 0, -42, distance)
    );
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:12,代码来源:ZoomOutRightAnimator.java

示例4: filterViewGroup

import android.view.ViewGroup; //导入方法依赖的package包/类
void filterViewGroup(MotionEvent ev) {
    int downX = Math.round(ev.getX());
    int downY = Math.round(ev.getY());
    int size = mChildViewGroups.size();
    mInAreaViewGroups.clear();
    for (int i = 0; i < size; i++) {
        ViewGroup child = mChildViewGroups.get(i);
        if (child == null || child.getVisibility() == View.GONE)
            continue;
        if (downX > child.getLeft() && downX < child.getRight() && downY > child.getTop() && downY < child.getBottom())
            mInAreaViewGroups.add(child);
    }
}
 
开发者ID:Sunzxyong,项目名称:PullToLoad,代码行数:14,代码来源:PullToRefreshLayout.java

示例5: animateRevealColor

import android.view.ViewGroup; //导入方法依赖的package包/类
private void animateRevealColor(ViewGroup viewRoot, @ColorRes int color) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    animateRevealColorFromCoordinates(viewRoot, color, cx, cy);
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:6,代码来源:RevealActivity.java


注:本文中的android.view.ViewGroup.getLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。