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


Java View.getY方法代码示例

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


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

示例1: maybeInitProperties

import android.view.View; //导入方法依赖的package包/类
@SuppressLint("PrivateResource")
private void maybeInitProperties(ImageView child, View dependency) {
    if (startYPosition == 0)
        startYPosition = (int) (dependency.getY());

    if (finalYPosition == 0)
        finalYPosition = (dependency.getHeight() / 2);

    if (startHeight == 0)
        startHeight = child.getHeight();

    if (finalHeight == 0)
        finalHeight = context.getResources().getDimensionPixelOffset(R.dimen.image_small_width);

    if (startXPosition == 0)
        startXPosition = (int) (child.getX() + (child.getWidth() / 2));

    if (finalXPosition == 0)
        finalXPosition = context.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material) + (finalHeight / 2);

    if (startToolbarPosition == 0)
        startToolbarPosition = dependency.getY() + (dependency.getHeight() / 2);
}
 
开发者ID:FarshidABZ,项目名称:CoordinatorBehavior,代码行数:24,代码来源:ImageBehavior.java

示例2: createShowItemAnimator

import android.view.View; //导入方法依赖的package包/类
private Animator createShowItemAnimator(View item) {

        float dx = fab.getX() - item.getX();
        float dy = fab.getY() - item.getY();

        item.setRotation(0f);
        item.setTranslationX(dx);
        item.setTranslationY(dy);

        Animator anim = ObjectAnimator.ofPropertyValuesHolder(
                item,
//                AnimatorUtils.rotation(0f, 720f),
                AnimatorUtils.translationX(dx, 0f),
                AnimatorUtils.translationY(dy, 0f)
        );

        return anim;
    }
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:19,代码来源:MainActivity.java

示例3: maybeInitProperties

import android.view.View; //导入方法依赖的package包/类
private void maybeInitProperties(ImageView child, View dependency) {
    if (mStartYPosition == 0)
        mStartYPosition = (int) (dependency.getY());

    if (mFinalYPosition == 0)
        mFinalYPosition = (dependency.getHeight() /2);

    if (mStartHeight == 0)
        mStartHeight = child.getHeight();

    if (mStartXPosition == 0)
        mStartXPosition = (int) (child.getX() + (child.getWidth() / 2));

    if (mFinalXPosition == 0)
        mFinalXPosition = mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material) + ((int) mCustomFinalHeight / 2);

    if (mStartToolbarPosition == 0)
        mStartToolbarPosition = dependency.getY();

    if (mChangeBehaviorPoint == 0) {
        mChangeBehaviorPoint = (child.getHeight() - mCustomFinalHeight) / (2f * (mStartYPosition - mFinalYPosition));
    }
}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:24,代码来源:TeamLogoBehavior.java

示例4: createAnimationImpl

import android.view.View; //导入方法依赖的package包/类
@Override
@Nullable Animation createAnimationImpl(View view, int x, int y, int width, int height) {
  boolean animateLocation = view.getX() != x || view.getY() != y;
  boolean animateSize = view.getWidth() != width || view.getHeight() != height;
  if (!animateLocation && !animateSize) {
    return null;
  } else if (animateLocation && !animateSize && USE_TRANSLATE_ANIMATION) {
    // Use GPU-accelerated animation, however we loose the ability to resume interrupted
    // animation where it was left off. We may be able to listen to animation interruption
    // and set the layout manually in this case, so that next animation kicks off smoothly.
    return new TranslateAnimation(view.getX() - x, 0, view.getY() - y, 0);
  } else {
    // Animation is sub-optimal for perf, but scale transformation can't be use in this case.
    return new PositionAndSizeAnimation(view, x, y, width, height);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:LayoutUpdateAnimation.java

示例5: calcScrollInfo

import android.view.View; //导入方法依赖的package包/类
private ScrollInfo calcScrollInfo(View movingView) {
    ScrollInfo result = new ScrollInfo();
    float dx = movingView.getX() - mChildInitX;
    float dy = movingView.getY() - mChildInitY;
    int direction;
    if (Float.compare(dx, 0) == 0 && Float.compare(dy, 0) == 0) {
        direction = StackCardsView.SWIPE_NONE;
    } else {
        if (Math.abs(dx) * SLOPE > Math.abs(dy)) {
            direction = dx > 0 ? StackCardsView.SWIPE_RIGHT : StackCardsView.SWIPE_LEFT;
        } else {
            direction = dy > 0 ? StackCardsView.SWIPE_DOWN : StackCardsView.SWIPE_UP;
        }
    }
    log(TAG, "calcScrollInfo,direction=" + direction + ",dx=" + dx + ",dy=" + dy);
    result.direction = direction;
    double distance = Math.sqrt(dx * dx + dy * dy);
    float dismiss_distance = mSwipeView.getDismissDistance();
    if (distance >= dismiss_distance) {
        result.progress = 1;
    } else {
        result.progress = (float) distance / dismiss_distance;
    }
    return result;
}
 
开发者ID:wensefu,项目名称:StackCardsView,代码行数:26,代码来源:SwipeTouchHelper.java

示例6: getHeaderTop

import android.view.View; //导入方法依赖的package包/类
private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) {
    int headerHeight = getHeaderHeightForLayout(header);
    int top = ((int) child.getY()) - headerHeight;
    if (layoutPos == 0) {

        final int count = parent.getChildCount();
        for (int i = 1; (i < count); i++) {
            int adapterPosHere = parent.getChildAdapterPosition(parent.getChildAt(i));
            if (adapterPosHere != RecyclerView.NO_POSITION && hasHeader(adapterPosHere)) {
                final View next = parent.getChildAt(i);
                final int offset = ((int) next.getY()) - (header.getHeight() + getHeaderHeightForLayout(getHeader(parent, adapterPosHere).itemView));
                if (offset < 0) {
                    return offset;
                }
                break;
            }
        }
    }
    top = Math.max(0, top);
    return top;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:StickyHeaderDecoration.java

示例7: setChildRotationVertical

import android.view.View; //导入方法依赖的package包/类
/**
 * Given that the is {@link Orientation#VERTICAL}, apply rotation if rotation is enabled.
 */
private void setChildRotationVertical(@Gravity int gravity, View child, int radius, Point center) {
    if (!rotate) {
        child.setRotation(0);
        return;
    }
    boolean childPastCenter = (child.getY() + child.getHeight() / 2) > center.y;
    float directionMult;
    if (gravity == Gravity.END) {
        directionMult = childPastCenter ? -1 : 1;
    } else {
        directionMult = childPastCenter ? 1 : -1;
    }
    final float opposite = Math.abs(child.getY() + child.getHeight() / 2 - center.y);
    child.setRotation((float) (directionMult * Math.toDegrees(Math.asin(opposite / radius))));
}
 
开发者ID:cdflynn,项目名称:turn-layout-manager,代码行数:19,代码来源:TurnLayoutManager.java

示例8: onLayoutFinished

import android.view.View; //导入方法依赖的package包/类
@Override
public void onLayoutFinished(View child, RecyclerView parent) {

    // Figure out % progress from top to bottom.
    float centerOffset = (child.getHeight() / 2.0f) / parent.getHeight();
    float yRelativeToCenterOffset = (child.getY() / parent.getHeight()) + centerOffset;

    // Normalize for center.
    float progressToCenter = Math.abs(0.5f - yRelativeToCenterOffset);

    // Adjust to the maximum scale.
    progressToCenter = Math.min(progressToCenter, MAX_ICON_PROGRESS);

    child.setScaleX(1 - progressToCenter);
    child.setScaleY(1 - progressToCenter);
}
 
开发者ID:googlesamples,项目名称:android-WearAccessibilityApp,代码行数:17,代码来源:ScalingScrollLayoutCallback.java

示例9: getY

import android.view.View; //导入方法依赖的package包/类
public static float getY(View view) {
    if (View10.NEED_PROXY) {
        return View10.wrap(view).getY();
    } else {
        return view.getY();
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:8,代码来源:ViewProxy.java

示例10: isChildUnder

import android.view.View; //导入方法依赖的package包/类
private static boolean isChildUnder(View child, float x, float y) {
    final float left = child.getX();
    final float top = child.getY();
    final float right = left + child.getWidth();
    final float bottom = top + child.getHeight();
    return x >= left && y >= top && x < right && y < bottom;
}
 
开发者ID:haruue,项目名称:OpenWithX,代码行数:8,代码来源:ResolverDrawerLayout.java

示例11: getHeaderTop

import android.view.View; //导入方法依赖的package包/类
private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) {
    int headerHeight = getHeaderHeightForLayout(header);
    int top = ((int) child.getY()) - headerHeight;
    if (layoutPos == 0) {
        final int count = parent.getChildCount();
        final long currentId = mListener.getHeaderId(adapterPos);
        // find next view with header and compute the offscreen push if needed
        for (int i = 1; i < count; i++) {
            int adapterPosHere = parent.getChildAdapterPosition(parent.getChildAt(i));
            if (adapterPosHere != RecyclerView.NO_POSITION) {
                long nextId = mListener.getHeaderId(adapterPosHere);
                if (nextId != currentId) {
                    final View next = parent.getChildAt(i);
                    final int offset = ((int) next.getY()) - (headerHeight + getHeader(parent, adapterPosHere).itemView.getHeight());
                    if (offset < 0) {
                        return offset;
                    } else {
                        break;
                    }
                }
            }
        }

        top = Math.max(0, top);
    }

    return top;
}
 
开发者ID:yedashen,项目名称:UltimateRecyclerView,代码行数:29,代码来源:StickyHeaderDecoration.java

示例12: onDependentViewChanged

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, CardView child, View dependency) {
    initValues(child);
    child.setY(dependency.getY() - child.getHeight() / 2);
    if (notFirstRun) {
        currentPos = dependency.getY();
        if (currentPos > hidingPos)
            animateIn(child);
        else animateOut(child);
    } else {
        child.setX(shownPosX);
        notFirstRun = true;
    }
    return false;
}
 
开发者ID:architjn,项目名称:SharePanel,代码行数:16,代码来源:SlideHideBehaviour.java

示例13: updateChild

import android.view.View; //导入方法依赖的package包/类
@Override
public void updateChild(View child, WearableRecyclerView parent) {
    super.updateChild(child, parent);

    // Figure out % progress from top to bottom
    float centerOffset = ((float) child.getHeight() / 2.0f) /  (float) recycler.getHeight();
    float yRelativeToCenterOffset = (child.getY() / recycler.getHeight()) + centerOffset;

    // Normalize for center
    float progressToCenter = Math.abs(0.5f - yRelativeToCenterOffset) * 2;
    progressToCenter = Math.min(0.8f, progressToCenter);

    child.setAlpha(1 - progressToCenter);
}
 
开发者ID:matejdro,项目名称:WearVibrationCenter,代码行数:15,代码来源:TimedMuteActivity.java

示例14: deleteItemInTheFirstLine_ItemHasMaximumHeight_SameStartPadding

import android.view.View; //导入方法依赖的package包/类
@Test
public void deleteItemInTheFirstLine_ItemHasMaximumHeight_SameStartPadding() throws Exception {
    //arrange
    //just adapt input items list to required start values
    items.remove(1);
    activity.runOnUiThread(() -> activity.initialize());

    ViewInteraction recyclerView = onView(withId(R.id.rvTest)).check(matches(isDisplayed()));

    InstrumentalUtil.waitForIdle();

    View second = layoutManager.getChildAt(1);
    int startHeight = second.getHeight();
    double expectedY = second.getY();

    //act
    recyclerView.perform(
            actionDelegate(((uiController, view) -> items.remove(1))),
            notifyItemRemovedAction(1));

    InstrumentalUtil.waitForIdle();

    second = layoutManager.getChildAt(1);
    int endHeight = second.getHeight();
    double resultY = second.getY();

    //assert
    //check test behaviour
    assumeTrue(startHeight > endHeight);

    assertNotEquals(0, expectedY, 0.01);
    assertNotEquals(0, resultY, 0.01);
    assertEquals(resultY, expectedY, 0.01);
}
 
开发者ID:sathishmscict,项目名称:ChipsLayoutManager,代码行数:35,代码来源:FewChipsRowTest.java

示例15: findListChildUnder

import android.view.View; //导入方法依赖的package包/类
private View findListChildUnder(float x, float y) {
    View v = findChildUnder(x, y);
    while (v != null) {
        x -= v.getX();
        y -= v.getY();
        if (v instanceof RecyclerView/*AbsListView*/) {
            // One more after this.
            return findChildUnder((ViewGroup) v, x, y);
        }
        v = v instanceof ViewGroup ? findChildUnder((ViewGroup) v, x, y) : null;
    }
    return null;
}
 
开发者ID:RikkaW,项目名称:Bridge,代码行数:14,代码来源:ResolverDrawerLayout.java


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