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


Java View.setY方法代码示例

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


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

示例1: addView

import android.view.View; //导入方法依赖的package包/类
void addView(final int position) {
	View root = createView(position, mParent);
	root.setOnTouchListener(this);
	root.setTag(R.id.cardstack_internal_position_tag, position);
	root.setLayerType(View.LAYER_TYPE_HARDWARE, null);

	mCardPaddingInternal = root.getPaddingTop();

	FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, fullCardHeight);
	root.setLayoutParams(lp);
	if (mShowInitAnimation) {
		root.setY(getCardFinalY(position));
		setScreenTouchable(false);
	} else {
		root.setY(getCardOriginalY(position) - mParentPaddingTop);
		setScreenTouchable(true);
	}

	mCardViews[position] = root;

	mParent.addView(root);
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:23,代码来源:CardStackAdapter.java

示例2: createAddSelectedTabLayoutListener

import android.view.View; //导入方法依赖的package包/类
/**
 * Creates and returns a layout listener, which allows to show a tab as the currently selected
 * one, once it view has been inflated.
 *
 * @param item
 *         The item, which corresponds to the tab, which has been added, as an instance of the
 *         class {@link AbstractItem}. The item may not be null
 * @return The listener, which has been created, as an instance of the type {@link
 * OnGlobalLayoutListener}. The listener may not be null
 */
@NonNull
private OnGlobalLayoutListener createAddSelectedTabLayoutListener(
        @NonNull final AbstractItem item) {
    return new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            View view = item.getView();
            FrameLayout.LayoutParams layoutParams =
                    (FrameLayout.LayoutParams) view.getLayoutParams();
            view.setAlpha(1f);
            getArithmetics().setPivot(Axis.DRAGGING_AXIS, item,
                    getArithmetics().getPivot(Axis.DRAGGING_AXIS, item, DragState.NONE));
            getArithmetics().setPivot(Axis.ORTHOGONAL_AXIS, item,
                    getArithmetics().getPivot(Axis.ORTHOGONAL_AXIS, item, DragState.NONE));
            view.setX(layoutParams.leftMargin);
            view.setY(layoutParams.topMargin);
            getArithmetics().setScale(Axis.DRAGGING_AXIS, item, 1);
            getArithmetics().setScale(Axis.ORTHOGONAL_AXIS, item, 1);
        }

    };
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:34,代码来源:PhoneTabSwitcherLayout.java

示例3: setPosition

import android.view.View; //导入方法依赖的package包/类
@Override
public final void setPosition(@NonNull final Axis axis, @NonNull final AbstractItem item,
                              final float position) {
    ensureNotNull(axis, "The axis may not be null");
    ensureNotNull(item, "The item may not be null");
    View view = item.getView();

    if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
        Toolbar[] toolbars = getTabSwitcher().getToolbars();
        view.setY((getTabSwitcher().areToolbarsShown() && getTabSwitcher().isSwitcherShown() &&
                toolbars != null ?
                toolbars[TabSwitcher.PRIMARY_TOOLBAR_INDEX].getHeight() - tabInset : 0) +
                getTabSwitcherPadding(axis, Gravity.START) + position);
    } else {
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) view.getLayoutParams();
        view.setX(position + layoutParams.leftMargin + getTabSwitcher().getPaddingLeft() / 2f -
                getTabSwitcher().getPaddingRight() / 2f -
                (getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE &&
                        getTabSwitcher().isSwitcherShown() ?
                        stackedTabCount * stackedTabSpacing / 2f : 0));
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:24,代码来源:PhoneArithmetics.java

示例4: showMoreKeysPanel

import android.view.View; //导入方法依赖的package包/类
@Override
public void showMoreKeysPanel(final View parentView, final Controller controller,
        final int pointX, final int pointY, final KeyboardActionListener listener) {
    mController = controller;
    mListener = listener;
    final View container = getContainerView();
    // The coordinates of panel's left-top corner in parentView's coordinate system.
    // We need to consider background drawable paddings.
    final int x = pointX - getDefaultCoordX() - container.getPaddingLeft() - getPaddingLeft();
    final int y = pointY - container.getMeasuredHeight() + container.getPaddingBottom()
            + getPaddingBottom();

    parentView.getLocationInWindow(mCoordinates);
    // Ensure the horizontal position of the panel does not extend past the parentView edges.
    final int maxX = parentView.getMeasuredWidth() - container.getMeasuredWidth();
    final int panelX = Math.max(0, Math.min(maxX, x)) + CoordinateUtils.x(mCoordinates);
    final int panelY = y + CoordinateUtils.y(mCoordinates);
    container.setX(panelX);
    container.setY(panelY);

    mOriginX = x + container.getPaddingLeft();
    mOriginY = y + container.getPaddingTop();
    controller.onShowMoreKeysPanel(this);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:25,代码来源:MoreKeysKeyboardView.java

示例5: moveCards

import android.view.View; //导入方法依赖的package包/类
private void moveCards(int positionOfCardToMove, float diff) {
	if (diff < 0 || positionOfCardToMove < 0 || positionOfCardToMove >= getCount())
		return;
	for (int i = positionOfCardToMove; i < getCount(); i++) {
		final View child = mCardViews[i];
		float diffCard = diff / scaleFactorForElasticEffect;
		if (mParallaxEnabled) {
			if (mParallaxScale > 0) {
				diffCard = diffCard * (mParallaxScale / 3) * (getCount() + 1 - i);
			} else {
				int scale = mParallaxScale * -1;
				diffCard = diffCard * (i * (scale / 3) + 1);
			}
		} else
			diffCard = diffCard * (getCount() * 2 + 1);
		child.setY(getCardOriginalY(i) + diffCard);
	}
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:19,代码来源:CardStackAdapter.java

示例6: setPosition

import android.view.View; //导入方法依赖的package包/类
@Override
public final void setPosition(@NonNull final Axis axis, @NonNull final AbstractItem item,
                              final float position) {
    ensureNotNull(axis, "The axis may not be null");
    ensureNotNull(item, "The item may not be null");
    View view = item.getView();

    if (axis == Axis.DRAGGING_AXIS) {
        Toolbar[] toolbars = getTabSwitcher().getToolbars();
        view.setX((getTabSwitcher().areToolbarsShown() && toolbars != null ? Math.max(0,
                toolbars[TabSwitcher.PRIMARY_TOOLBAR_INDEX].getWidth() - tabOffset) : 0) +
                position);
    } else {
        view.setY((tabContainerHeight - tabHeight) + position);
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:17,代码来源:TabletArithmetics.java

示例7: slidingToY

import android.view.View; //导入方法依赖的package包/类
public void slidingToY(View view ,float y){
    if(view == null){
        return;
    }
    view.clearAnimation();
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        view.setY(y);
    }else{
        ViewHelper.setY(view, y);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:Instrument.java

示例8: render

import android.view.View; //导入方法依赖的package包/类
@Override
public void render(CoachmarkViewLayout layout, View description) {

    RectF circle = layout.calcCircleRectF();
    RectF screenRectangle = layout.calcScreenRectF();

    if(circle.centerY() > screenRectangle.height() / 2){
        description.setY(description.getContext().getResources().getDimension(R.dimen.description_padding));
    }else{
        description.setY(screenRectangle.height() - description.getContext().getResources().getDimension(R.dimen.description_padding) - description.getHeight());
    }

}
 
开发者ID:Kaufland,项目名称:andcoachmark,代码行数:14,代码来源:TopOrBottomDescriptionRenderer.java

示例9: setValue

import android.view.View; //导入方法依赖的package包/类
private void setValue(int propertyConstant, float value) {
    View v = (View) this.mView.get();
    if (v != null) {
        switch (propertyConstant) {
            case 1:
                v.setTranslationX(value);
                return;
            case 2:
                v.setTranslationY(value);
                return;
            case 4:
                v.setScaleX(value);
                return;
            case 8:
                v.setScaleY(value);
                return;
            case 16:
                v.setRotation(value);
                return;
            case 32:
                v.setRotationX(value);
                return;
            case 64:
                v.setRotationY(value);
                return;
            case 128:
                v.setX(value);
                return;
            case 256:
                v.setY(value);
                return;
            case 512:
                v.setAlpha(value);
                return;
            default:
                return;
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:40,代码来源:ViewPropertyAnimatorHC.java

示例10: onDependentViewChanged

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
    float tabScrollY = dependency.getTranslationY() / getHeaderOffset() * (dependency.getHeight() - getTitleHeight());
    float y = dependency.getHeight() - tabScrollY;
    child.setY(y);
    return true;
}
 
开发者ID:Othershe,项目名称:BehaviorDemo,代码行数:8,代码来源:MainTabBehavior.java

示例11: resetSubButton

import android.view.View; //导入方法依赖的package包/类
private void resetSubButton(Point center, SubButton subButton, View subButtonView) {
    if (subButton != null) {
        int floatingMenuButtonWidth = floatingMenuButton.getWidth();
        int floatingMenuButtonHeight = floatingMenuButton.getHeight();
        int xResetPos = center.x + floatingMenuButtonWidth / 2;
        int yResetPos = center.y - floatingMenuButtonHeight / 2;
        subButtonView.setX(xResetPos);
        subButtonView.setY(yResetPos);
        subButtonView.setScaleX(0);
        subButtonView.setScaleY(0);
        subButton.setX(xResetPos);
        subButton.setY(yResetPos);
        subButton.setAlpha(0);
    }
}
 
开发者ID:rjsvieira,项目名称:floatingMenu,代码行数:16,代码来源:FloatingMenuAnimationHandler.java

示例12: offsetAndScaleButtons

import android.view.View; //导入方法依赖的package包/类
private void offsetAndScaleButtons(float centerX, float centerY, float angleStep, float offset, float scale) {
    for (int i = 0, cnt = mButtons.size(); i < cnt; i++) {
        final float angle = angleStep * i - 90;
        final float x = (float) Math.cos(Math.toRadians(angle)) * offset;
        final float y = (float) Math.sin(Math.toRadians(angle)) * offset;

        final View button = mButtons.get(i);
        button.setX(centerX + x);
        button.setY(centerY + y);
        button.setScaleX(1.0f * scale);
        button.setScaleY(1.0f * scale);
    }
}
 
开发者ID:Ramotion,项目名称:circle-menu-android,代码行数:14,代码来源:CircleMenuView.java

示例13: setY

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

示例14: createHideSwitcherAnimationListener

import android.view.View; //导入方法依赖的package包/类
/**
 * Creates and returns an animation listener, which allows to inflate or remove the views, which
 * are used to visualize tabs, when an animation, which is used to hide the tab switcher,
 * has been finished.
 *
 * @return The animation listener, which has been created, as an instance of the type {@link
 * AnimatorListener}. The listener may not be null
 */
@NonNull
private AnimatorListener createHideSwitcherAnimationListener() {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            AbstractTabItemIterator iterator =
                    new TabItemIterator.Builder(getTabSwitcher(), viewRecycler).create();
            TabItem tabItem;

            while ((tabItem = iterator.next()) != null) {
                if (tabItem.getTab() == getModel().getSelectedTab()) {
                    Pair<View, Boolean> pair = viewRecycler.inflate(tabItem);
                    View view = pair.first;
                    FrameLayout.LayoutParams layoutParams =
                            (FrameLayout.LayoutParams) view.getLayoutParams();
                    view.setAlpha(1f);
                    getArithmetics().setScale(Axis.DRAGGING_AXIS, view, 1);
                    getArithmetics().setScale(Axis.ORTHOGONAL_AXIS, view, 1);
                    view.setX(layoutParams.leftMargin);
                    view.setY(layoutParams.topMargin);
                } else {
                    viewRecycler.remove(tabItem);
                }
            }

            viewRecycler.clearCache();
            recyclerAdapter.clearCachedPreviews();
            tabViewBottomMargin = -1;
        }

    };
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:43,代码来源:PhoneTabSwitcherLayout.java

示例15: addNextView

import android.view.View; //导入方法依赖的package包/类
private void addNextView() {
    if (adapterIndex < mAdapter.getCount()) {
        View newBottomChild = mAdapter.getView(adapterIndex, null, this);
        newBottomChild.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        //todo: i'm setting the card to invisible initially and making it visible when i animate
        //later
        newBottomChild.setAlpha(0);
        newBottomChild.setY(getPaddingTop());
        final long viewId = mAdapter.getItemId(adapterIndex);

        CardContainer card = new CardContainer(newBottomChild, this, new CardContainerCallback(viewId));

        card.setPositionWithinAdapter(adapterIndex);

        if (leftImageResource != 0) {
            card.setLeftImageResource(leftImageResource);
        }
        if (rightImageResource != 0) {
            card.setRightImageResource(rightImageResource);
        }

        card.setId(viewId);

        deck.addBack(card);
        adapterIndex++;
    }
}
 
开发者ID:pao11,项目名称:SwipeDeckRelease,代码行数:28,代码来源:SwipeDeck.java


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