android.widget.TextView.setTranslationY()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中android.widget.TextView.setTranslationY()方法的一些代码示例,展示了TextView.setTranslationY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setTranslationY()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setTranslationY

TextView.setTranslationY介绍

暂无

代码示例

代码示例来源:origin: prolificinteractive/material-calendarview

private void doTranslation(final TextView title, final int translate) {
 if (orientation == MaterialCalendarView.HORIZONTAL) {
  title.setTranslationX(translate);
 } else {
  title.setTranslationY(translate);
 }
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void setTranslationY(float translationY) {
  super.setTranslationY(translationY);
  invalidateParentIfNeeded();
  fireOnTransformationChangedListener();
}

代码示例来源:origin: stackoverflow.com

v.setTranslationY(300 * (float)Math.sin(angleRad));

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: iielse/ImageWatcher

@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;
}

代码示例来源:origin: Hitomis/FunGameRefresh

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);
}

代码示例来源:origin: iielse/ImageWatcher

tOverflowCount.setTranslationY((i / column) * (imageSize + mSpace));

代码示例来源:origin: googlesamples/android-WatchFace

@Override // WearableListView.OnScrollListener
public void onAbsoluteScrollChange(int scroll) {
  float newTranslation = Math.min(-scroll, 0);
  mHeader.setTranslationY(newTranslation);
}

代码示例来源:origin: marcouberti/american_sunsets_watch_face

@Override // WearableListView.OnScrollListener
public void onAbsoluteScrollChange(int scroll) {
  float newTranslation = Math.min(-scroll, 0);
  mHeader.setTranslationY(newTranslation);
}

代码示例来源:origin: marcouberti/american_sunsets_watch_face

@Override // WearableListView.OnScrollListener
public void onAbsoluteScrollChange(int scroll) {
  float newTranslation = Math.min(-scroll, 0);
  mHeader.setTranslationY(newTranslation);
}

代码示例来源:origin: byc4426/ImageWatcher

@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;
}

代码示例来源:origin: enricocid/LaunchEnr

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);
  }
}

代码示例来源:origin: SimonMarquis/Android-PreferencesManager

/**
 * 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();
}

代码示例来源:origin: w446108264/StickHeaderLayout

@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));
  }
});

代码示例来源:origin: smuyyh/SprintNBA

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);
    }
  }
}

代码示例来源:origin: wudifamo/Neleme

@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);
}

代码示例来源:origin: kubode/Wiggle

@Override
public void setTranslationY(float translationY) {
  super.setTranslationY(translationY);
  if (translationY != 0f) setLastNon0TranslationY(translationY);
}

代码示例来源:origin: bq/MarkerSeekBar

@Override
  public void onGlobalLayout() {
    if (markerTextView.getHeight() > 0) {
      markerTextView.setTranslationY(markerView.getCircleCenterY() - markerTextView.getHeight() / 2);
    }
  }
});

代码示例来源:origin: iielse/RetailMeNotList

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();
}

代码示例来源:origin: stackoverflow.com

final TextView tv = (TextView) findViewById(R.id.textView);
   tv.setTranslationX(tv.getTranslationX() + 10);
   tv.setTranslationY(tv.getTranslationY() + 10);
   tv.invalidate();

相关文章

TextView类方法