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

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

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

TextView.getTranslationX介绍

暂无

代码示例

代码示例来源:origin: dabutaizha/juzimi

private void startAlternateAnimation() {
    Log.d("dabutaizha", "into startAlternateAnimation");
    Object obj = mQuestionIcon.getTag();
    if (obj == null || "animation_start".equals(obj)) {
      float curTranslationX = mQuestionIcon.getTranslationX();
      ObjectAnimator iconAnimatorStart = ObjectAnimator.ofFloat(mQuestionIcon, "translationX", curTranslationX, -800f);
      iconAnimatorStart.start();
      mQuestionIcon.setTag("animation_end");

      mTipContent.setVisibility(View.VISIBLE);
      ObjectAnimator contentAnimatorStart = ObjectAnimator.ofFloat(mTipContent, "alpha", 0f, 1f);
      contentAnimatorStart.start();
    }
    if ("animation_end".equals(obj)) {
      float curTranslationX = mQuestionIcon.getTranslationX();
      ObjectAnimator iconAnimatorStart = ObjectAnimator.ofFloat(mQuestionIcon, "translationX", curTranslationX, 0f);
      iconAnimatorStart.start();
      mQuestionIcon.setTag("animation_start");

      ObjectAnimator contentAnimatorStart = ObjectAnimator.ofFloat(mTipContent, "alpha", 1f, 0f);
      contentAnimatorStart.start();
    }
  }
}

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

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

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

int[] titleTextViewPoint = new int[2];
mTitleTextView.getLocationOnScreen(titleTextViewPoint);
mTitleTextViewPoint[0] = titleTextViewPoint[0] - mTitleTextView.getTranslationX() -
    (mToolbarTextView.getWidth() > newTextWidth ?
        (originTextWidth - newTextWidth) / 2f : 0);

相关文章

微信公众号

最新文章

更多

TextView类方法