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

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

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

TextView.setTranslationX介绍

暂无

代码示例

代码示例来源: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 setTranslationX(float translationX) {
  super.setTranslationX(translationX);
  invalidateParentIfNeeded();
  fireOnTransformationChangedListener();
}

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

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

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

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

代码示例来源:origin: why168/LoopViewPagerLayout

@Override
public void onPageSelected(int position) {
  int i = position % bannerInfos.size();
  if (i == 0) {
    animIndicator.setTranslationX(totalDistance * 0.0f);
  } else if (i == bannerInfos.size() - 1) {
    animIndicator.setTranslationX(totalDistance * 1.0f);
  }
}

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

final TextView first = (TextView) findViewById(R.id.first);
final TextView second = (TextView) findViewById(R.id.second);

final ValueAnimator animator = ValueAnimator.ofFloat(0.0f, 1.0f);
animator.setRepeatCount(ValueAnimator.INFINITE);
animator.setInterpolator(new LinearInterpolator());
animator.setDuration(9000L);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
  @Override
  public void onAnimationUpdate(ValueAnimator animation) {
    final float progress = (float) animation.getAnimatedValue();
    final float width = first.getWidth();
    final float translationX = width * progress;
    first.setTranslationX(translationX);
    second.setTranslationX(translationX - width);
  }
});
animator.start();

代码示例来源:origin: aserbao/AndroidCamera

@Override
public void OnScrollBorder(float start, float end) {
  selTimeTv.setTranslationX(start - 10);
  mV = fnum.format((end * 30 / thumbnailCountDownTimeView.getWidth()));
  selTimeTv.setText(mV + "s");
}

代码示例来源:origin: fengmaolian/AnalyzeRecyclerViewWithBGARefreshLayout

@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
  super.onScrollChanged(l, t, oldl, oldt);
  Log.i("TAG", "11");
  mTextView_Delete.setTranslationX(l - mScrollWidth);
}
/**

代码示例来源:origin: why168/LoopViewPagerLayout

@Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
      if (loopPagerAdapterWrapper.getCount() > 0) {
        float length = ((position % bannerInfos.size()) + positionOffset) / (bannerInfos.size() - 1);
        // 为了防止最后一小红点滑出去
        if (length >= 1)
          return;
        float path = length * totalDistance;
//                L.e("path " + path + " = length * " + length + " totalDistance " + totalDistance);
//                ViewCompat.setTranslationX(animIndicator, path);
        animIndicator.setTranslationX(path);
      }
    }

代码示例来源:origin: whyalwaysmea/BigBoom

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    // 获取到固定的view
    View stickyInfoView = recyclerView.findChildViewUnder(10, DensityUtils.dp2px(mContext, 80));
    if (stickyInfoView != null && stickyInfoView.getContentDescription() != null) {
      mYear.setText(String.valueOf(stickyInfoView.getContentDescription()));
    }
    // Get the sticky view's translationY by the first view below the sticky's height.
    View transInfoView = recyclerView.findChildViewUnder(
        DensityUtils.dp2px(mContext, 165), DensityUtils.dp2px(mContext, 80));
    if (transInfoView != null && transInfoView.getTag() != null) {
      int transViewStatus = (int) transInfoView.getTag();
      int dealtX = transInfoView.getLeft() - mYear.getMeasuredWidth();
      if (transViewStatus == CastWorksAdapter.HAS_STICKY_VIEW) {
        // If the first view below the sticky's height scroll off the screen,
        // then recovery the sticky view's translationY.
        if (transInfoView.getLeft() > 0 && transInfoView.getLeft() < mYear.getMeasuredWidth() + 10) {
          mYear.setTranslationX(dealtX);
        } else {
          mYear.setTranslationX(0);
        }
      } else if (transViewStatus == CastWorksAdapter.NONE_STICKY_VIEW) {
        mYear.setTranslationX(0);
      }
    }
  }
});

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

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

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

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

代码示例来源:origin: aserbao/AndroidCamera

int min = mStartTime * (MyApplication.screenWidth - (int) res.getDimension(R.dimen.dp20)) / 30;
selTimeTv.layout(min, 0, selTimeTv.getHeight(), selTimeTv.getWidth());
selTimeTv.setTranslationX((MyApplication.screenWidth - (int) res.getDimension(R.dimen.dp40)));
thumbnailCountDownTimeView.setMinWidth(min);
final DecimalFormat fnum = new DecimalFormat("##0.0");

代码示例来源:origin: hearsilent/AmazingAvatar

float yTitleOffset = (mToolbarTextPoint[1] - mTitleTextViewPoint[1]) * offset;
mTitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, newTextSize);
mTitleTextView.setTranslationX(xTitleOffset);
mTitleTextView.setTranslationY(yTitleOffset);

代码示例来源:origin: derry/delion

@Override
  public void onLayoutChange(View v, int left, int top, int right, int bottom,
      int oldLeft, int oldTop, int oldRight, int oldBottom) {
    mUrlBar.removeOnLayoutChangeListener(this);
    int[] newLoc = new int[2];
    mUrlBar.getLocationInWindow(newLoc);
    mUrlBar.setScaleX(scale);
    mUrlBar.setScaleY(scale);
    mUrlBar.setTranslationX(oldLoc[0] - newLoc[0]);
    mUrlBar.setTranslationY(oldLoc[1] - newLoc[1]);
    mUrlBar.animate().scaleX(1f).scaleY(1f).translationX(0).translationY(0)
        .setDuration(CUSTOM_TAB_TOOLBAR_SLIDE_DURATION_MS)
        .setInterpolator(BakedBezierInterpolator.TRANSFORM_CURVE)
        .setListener(new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            mTitleBar.animate().alpha(1f)
              .setInterpolator(BakedBezierInterpolator.FADE_IN_CURVE)
              .setDuration(CUSTOM_TAB_TOOLBAR_FADE_DURATION_MS).start();
          }
        }).start();
  }
});

相关文章

微信公众号

最新文章

更多

TextView类方法