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

The following are Jave code examples for showing how to use setTop() 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: garland-view-android   File: InnerLayoutManager.java   Source Code and License Vote up 7 votes
private void applyTransformation() {
    for (int i = 0, cnt = getChildCount(); i < cnt; i++) {
        final View view = getChildAt(i);
        final int viewHeight = view.getMeasuredHeight();

        if (view.getBottom() > 0) {
            final int viewBottom = view.getBottom();
            if (viewBottom - viewHeight < 0) {
                view.setTop(0);
            } else {
                view.setTop(viewBottom - viewHeight);
            }

            final int viewNewHeight = viewBottom - view.getTop();
            ((InnerItem) mRecyclerView.getChildViewHolder(view)).onItemViewHeightChanged(viewNewHeight);
        }

        if (view.getTop() > 0) {
            ((InnerItem) mRecyclerView.getChildViewHolder(view)).resetInnerLayoutOffset();
        }
    }
}
 
Example 2
Project: FancyAccordionView   File: AnimatorUtils.java   Source Code and License Vote up 5 votes
@Override
public void set(View view, Integer top) {
    view.setTop(top);
}
 
Example 3
Project: FancyAccordionView   File: AnimatorUtils.java   Source Code and License Vote up 5 votes
/**
 * Returns an animator that animates the bounds of a single view.
 */
public static Animator getBoundsAnimator(View view, int fromLeft, int fromTop, int fromRight,
                                         int fromBottom, int toLeft, int toTop, int toRight, int toBottom) {
    view.setLeft(fromLeft);
    view.setTop(fromTop);
    view.setRight(fromRight);
    view.setBottom(fromBottom);

    return ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofInt(VIEW_LEFT, toLeft),
            PropertyValuesHolder.ofInt(VIEW_TOP, toTop),
            PropertyValuesHolder.ofInt(VIEW_RIGHT, toRight),
            PropertyValuesHolder.ofInt(VIEW_BOTTOM, toBottom));
}