private void doTranslation(final TextView title, final int translate) { if (orientation == MaterialCalendarView.HORIZONTAL) { title.setTranslationX(translate); } else { title.setTranslationY(translate); } }
@Override public void setTranslationY(float translationY) { super.setTranslationY(translationY); invalidateParentIfNeeded(); fireOnTransformationChangedListener(); }
v.setTranslationY(300 * (float)Math.sin(angleRad));
nextTextView = (TextView) getRootView().findViewById(R.id.nextTextView); nextTextView.setTranslationY(getHeight()); nextTextView.setTranslationY(nextTextView.getHeight()); nextTextView.animate().translationY(0).setDuration(ANIMATION_DURATION).setListener(new Animator.AnimatorListener() { @Override public void onAnimationEnd(Animator animation) { currentTextView.setText(String.format(Locale.getDefault(), "%d", oldValue - 1)); currentTextView.setTranslationY(0); if (oldValue - 1 != desiredValue) { setValue(desiredValue); nextTextView.setTranslationY(-nextTextView.getHeight()); nextTextView.animate().translationY(0).setDuration(ANIMATION_DURATION).setListener(new Animator.AnimatorListener() { @Override public void onAnimationEnd(Animator animation) { currentTextView.setText(String.format(Locale.getDefault(), "%d", oldValue + 1)); currentTextView.setTranslationY(0); if (oldValue + 1 != desiredValue) { setValue(desiredValue);
@Override public View initialView(Context context) { tCurrentIdx = new TextView(context); LayoutParams lpCurrentIdx = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lpCurrentIdx.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; tCurrentIdx.setLayoutParams(lpCurrentIdx); tCurrentIdx.setTextColor(0xFFFFFFFF); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); float tCurrentIdxTransY = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, displayMetrics) + 0.5f; tCurrentIdx.setTranslationY(tCurrentIdxTransY); return tCurrentIdx; }
public void postEnd() { isStart = false; funGameView.postStatus(FunGameView.STATUS_GAME_PREPAR); topMaskView.setTranslationY(topMaskView.getTranslationY() + halfHitBlockHeight); bottomMaskView.setTranslationY(bottomMaskView.getTranslationY() - halfHitBlockHeight); maskReLayout.setAlpha(1.f); topMaskView.setVisibility(View.VISIBLE); bottomMaskView.setVisibility(View.VISIBLE); maskReLayout.setVisibility(View.VISIBLE); }
tOverflowCount.setTranslationY((i / column) * (imageSize + mSpace));
@Override // WearableListView.OnScrollListener public void onAbsoluteScrollChange(int scroll) { float newTranslation = Math.min(-scroll, 0); mHeader.setTranslationY(newTranslation); }
@Override // WearableListView.OnScrollListener public void onAbsoluteScrollChange(int scroll) { float newTranslation = Math.min(-scroll, 0); mHeader.setTranslationY(newTranslation); }
@Override // WearableListView.OnScrollListener public void onAbsoluteScrollChange(int scroll) { float newTranslation = Math.min(-scroll, 0); mHeader.setTranslationY(newTranslation); }
@Override public View initialView(Context context) { tCurrentIdx = new TextView(context); LayoutParams lpCurrentIdx = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lpCurrentIdx.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL; tCurrentIdx.setLayoutParams(lpCurrentIdx); tCurrentIdx.setTextColor(0xFFFFFFFF); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); float tCurrentIdxTransY = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -50, displayMetrics) + 0.5f; tCurrentIdx.setTranslationY(tCurrentIdxTransY); return tCurrentIdx; }
private void updatePopupY(int lastTouchY) { int height = mPopupView.getHeight(); float top = lastTouchY - (FAST_SCROLL_OVERLAY_Y_OFFSET_FACTOR * height); top = Math.max(mMaxWidth, Math.min(top, mRv.getScrollbarTrackHeight() - mMaxWidth - height)); mPopupView.setTranslationY(top); } }
/** * Show the label using an animation */ private void showLabel() { mLabel.setVisibility(View.VISIBLE); mLabel.setAlpha(0f); mLabel.setTranslationY(mLabel.getHeight()); mLabel.animate() .alpha(1f) .translationY(0f) .setDuration(ANIMATION_DURATION) .setListener(null).start(); }
@Override public void onHeaderTranslationY(float translationY) { float top = ((View)tv_title.getParent()).getBottom() - tv_title.getTop(); tv_title.setTranslationY(Math.max(0,tv_headertitle.getTop() + top + translationY)); } });
private void processStick(int firstVisibleItem, int totalItemCount) { if (firstVisibleItem < totalItemCount - 1 && mTitleMap.get(firstVisibleItem - mListView.getHeaderViewsCount() + 1) != null) { int nextTop = mListView.getChildAt(1).getTop(); if (nextTop <= mTitleHeight) { if (mStickView.getVisibility() != VISIBLE) { if (mAdapter == null || !mAdapter.isFilter()) { mStickView.setVisibility(VISIBLE); } } mStickView.setTranslationY(nextTop - mTitleHeight); } } }
@Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { offSet = verticalOffset; if (dhv == null) { return; } if (dhv.getTotalScrollRange() + verticalOffset < 100) { toolbar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.colorPrimary)); } else { toolbar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.transparent)); } toolbar_title.setTranslationY(dhv.getTotalScrollRange() + verticalOffset); }
@Override public void setTranslationY(float translationY) { super.setTranslationY(translationY); if (translationY != 0f) setLastNon0TranslationY(translationY); }
@Override public void onGlobalLayout() { if (markerTextView.getHeight() > 0) { markerTextView.setTranslationY(markerView.getCircleCenterY() - markerTextView.getHeight() / 2); } } });
private void animate(float percent) { iShadow.setAlpha(percent); tSubtitle.setAlpha(percent); MarginLayoutParams lpIcon = (MarginLayoutParams) iIcon.getLayoutParams(); lpIcon.height = (int) (normalHeight * 0.6f + normalHeight * 0.2f * percent); lpIcon.width = lpIcon.height; lpIcon.bottomMargin = (int) (normalHeight * 0.2f - normalHeight * 0.05f * percent); lpIcon.leftMargin = (int) (lpIcon.bottomMargin * (1 - 0.1f * percent)); tTitle.setTranslationY(-percent * tTitle.getHeight() / 2); tSubtitle.setTranslationY(-percent * tSubtitle.getHeight() / 2); int tmpColor = (int) colorEvaluator.evaluate(percent, filterColor, Color.TRANSPARENT); iFilter.setBackgroundColor(tmpColor); tTitle.setTextSize(20 + 5 * percent); tSubtitle.setTextSize(14 + 4 * percent); getLayoutParams().height = (int) (normalHeight + (expandedHeight - normalHeight) * percent); requestLayout(); }
final TextView tv = (TextView) findViewById(R.id.textView); tv.setTranslationX(tv.getTranslationX() + 10); tv.setTranslationY(tv.getTranslationY() + 10); tv.invalidate();