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

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

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

TextView.getX介绍

暂无

代码示例

代码示例来源:origin: google/santa-tracker-android

@Override
  public void run() {
    currentScoreX = currentScore.getX();
    currentScoreY = currentScore.getY();
  }
});

代码示例来源:origin: TwoWater/CustomizeView

private float getPositionDistance(int position) {
  float tarX = tabs.get(position + 1).getX();
  float oriX = tabs.get(position).getX();
  return oriX - tarX;
}

代码示例来源:origin: google/santa-tracker-android

"x", currentScore.getX(), centeredScorePlaceholder.getX()),
UIUtil.floatValue(
    "y", currentScore.getY(), centeredScorePlaceholder.getY()),
    "x", centeredScorePlaceholder.getX(), finalScorePlaceholder.getX()),
UIUtil.floatValue(
    "y", centeredScorePlaceholder.getY(), finalScorePlaceholder.getY()),

代码示例来源:origin: TwoWater/CustomizeView

private float getTabX(int position) {
  return tabs.get(position).getX() + tabs.get(position).getWidth() / 2;
}

代码示例来源:origin: TobiasBielefeld/Simple-Solitaire

/**
 * mirrors the textViews, if there are any. Used for left handed mode
 */
public void mirrorTextViews(RelativeLayout layoutGame){
  for (TextView textView : textViews){
    textView.setX(layoutGame.getWidth() - textView.getX() - Card.width);
  }
}

代码示例来源:origin: LuckSiege/EasyIndicator

private AnimatorSet buildIndicatorAnimatorTowards(TextView tv) {
  float x = tab_content.getX();
  ObjectAnimator xAnimator = ObjectAnimator.ofFloat(indicator, "X", indicator.getX(), tv.getX() + x);
  final ViewGroup.LayoutParams params = indicator.getLayoutParams();
  ValueAnimator widthAnimator = ValueAnimator.ofInt(params.width, tv.getMeasuredWidth());
  widthAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      params.width = (Integer) animation.getAnimatedValue();
      indicator.setLayoutParams(params);
    }
  });
  AnimatorSet set = new AnimatorSet();
  set.setInterpolator(new FastOutSlowInInterpolator());
  set.playTogether(xAnimator, widthAnimator);
  return set;
}

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

TextView res;

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

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

  img.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      img.setX(img.getX() - 5);
      changew(img.getX());
    }
  });
}

private void changew(float w){
  res.getLayoutParams().width = (int)(res.getX() +w);
  res.requestLayout();
  res.invalidate();
}

代码示例来源:origin: MZCretin/RelativeLayoutDemo

@Override
  public void onClick(View v) {
    String content = editText.getText().toString();
    if ( TextUtils.isEmpty(content) ) {
      Toast.makeText(context, "您没有任何输入!", Toast.LENGTH_SHORT).show();
    } else {
      if ( isNew ) {
        addTextView(null, currentX, currentY, content, colors[0], 0, 0);
      } else {
        addTextView(textView, textView.getX(), textView.getY(), content, colors[0], textView.getTextSize(), textView.getRotation());
      }
    }
    dialog.dismiss();
  }
});

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

if (position != GridView.INVALID_POSITION) {
   MyList.add(position);
   v.getParent().requestDisallowInterceptTouchEvent(true);
   TextView cellView = (TextView) gridView.getChildAt(position);
    centreX = cellView.getX() + cellView.getWidth()  / 2;
    centreY = cellView.getY() + cellView.getHeight() / 2;
 switch (event.getAction()) {
   case MotionEvent.ACTION_DOWN:
     newPaint.DrawLine.touch_start(x, y,centreX,centreY);

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

int[] tv01pos = {(int) tv01.getX(), (int) tv01.getY()};

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

float finalX = mTextView.getX() + layoutDifferenceX;
    mTextView.getX(), finalX);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(500);
float initialX = mTextView.getX() - layoutDifferenceX;
float finalX = mTextView.getX();

代码示例来源:origin: vogellacompany/codeexamples-android

.toString());
dest = 0 - measureTextCenter;
if (aniTextView.getX() < 0) {
  dest = 0;

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

private Region createRotatedRegion(TextView textView){
  Matrix matrix = new Matrix();
  matrix.setRotate(textView.getRotation(), textView.getX() + textView.getMeasuredWidth() / 2, textView.getY() + textView.getMeasuredHeight() / 2);

  Path path = new Path();
  Point LT = rotatePoint(matrix, textView.getX(), textView.getY());
  Point RT = rotatePoint(matrix, textView.getX() + textView.getMeasuredWidth(), textView.getY());
  Point RB = rotatePoint(matrix, textView.getX() + textView.getMeasuredWidth(), textView.getY() + textView.getMeasuredHeight());
  Point LB = rotatePoint(matrix, textView.getX(), textView.getY() + textView.getMeasuredHeight());

  path.moveTo(LT.x, LT.y);
  path.lineTo(RT.x, RT.y);
  path.lineTo(RB.x, RB.y);
  path.lineTo(LB.x, LB.y);

  Region region = new Region();
  region.setPath(path,  new Region(0, 0, textViewParent.getWidth(), textViewParent.getHeight()));
  return region;
}

private Point rotatePoint(Matrix matrix, float x, float y){
  float[] pts = new float[2];
  pts[0] = x;
  pts[1] = y;
  matrix.mapPoints(pts);
  return new Point((int)pts[0], (int)pts[1]);
}

代码示例来源:origin: MZCretin/RelativeLayoutDemo

height = textView.getHeight();
if ( mEvent != null ) {
  mTv_width = mEvent.getX() - textView.getX();
  mTv_height = mEvent.getY() - textView.getY();
mTv_widths = getMidPiont(( int ) mfX, ( int ) mfY, ( int ) msX, ( int ) msY).x - textView.getX();
mTv_heights = getMidPiont(( int ) mfX, ( int ) mfY, ( int ) msX, ( int ) msY).y - textView.getY();

代码示例来源:origin: MZCretin/RelativeLayoutDemo

startX = textView.getX();
startY = textView.getY();
  tv_widths = getMidPiont(( int ) fX, ( int ) fY, ( int ) sX, ( int ) sY).x - textView.getX();
  tv_heights = getMidPiont(( int ) fX, ( int ) fY, ( int ) sX, ( int ) sY).y - textView.getY();

代码示例来源:origin: githubwing/WingUE

private void performEnterAnimation() {
 initLocation();
 final float top = getResources().getDisplayMetrics().density * 20;
 final ValueAnimator translateVa = translateVa(mSearchBGTxt.getY(), top);
 final ValueAnimator scaleVa = scaleVa(1, 0.8f);
 final ValueAnimator alphaVa = alphaVa(0, 1f);
 originX = mHintTxt.getX();
 final float leftSpace = mArrowImg.getRight() * 2;
 final ValueAnimator translateVaX = translateVax(originX, leftSpace);
 setDuration(translateVa, scaleVa, translateVaX, alphaVa);
 star(translateVa, scaleVa, translateVaX, alphaVa);
}

代码示例来源:origin: MZCretin/RelativeLayoutDemo

/**
 * 对控件进行参数的更新操作
 *
 * @param tv
 */
private void updateTextViewParams(TextView tv, float rotation, float scale) {
  for ( int i = 0; i < listTvParams.size(); i++ ) {
    TextViewParams param = new TextViewParams();
    if ( tv.getTag().toString().equals(listTvParams.get(i).getTag()) ) {
      param.setRotation(rotation);
      param.setTextSize(( float ) (tv.getTextSize() / scaleTimes));
      param.setMidPoint(getViewMidPoint(tv));
      param.setScale(scale);
      textSize = tv.getTextSize() / 2;
      param.setWidth(tv.getWidth());
      param.setHeight(tv.getHeight());
      param.setX(tv.getX());
      param.setY(tv.getY());
      param.setTag(listTvParams.get(i).getTag());
      param.setContent(tv.getText().toString());
      param.setTextColor(tv.getCurrentTextColor());
      listTvParams.set(i, param);
      return;
    }
  }
}

代码示例来源:origin: githubwing/WingUE

private void performExitAnimation() {
 final float translateY = getTranslateY();
 final ValueAnimator translateVa = translateVa(mSearchBGTxt.getY(), mSearchBGTxt.getY() + translateY);
 final ValueAnimator scaleVa = scaleVa(0.8f, 1f);
 final ValueAnimator alphaVa = alphaVa(1f, 0f);
 exitListener(translateVa);
 final float currentX = mHintTxt.getX();
 ValueAnimator translateVaX = translateVax(currentX, originX);
 setDuration(translateVa, scaleVa, translateVaX, alphaVa);
 star(translateVa, scaleVa, translateVaX, alphaVa);
}

代码示例来源:origin: MZCretin/RelativeLayoutDemo

/**
 * //对状态进行保存操作
 *
 * @param textView
 * @return
 */
private void saveTextViewparams(TextView textView) {
  if ( textView != null ) {
    tvParams = new TextViewParams();
    tvParams.setRotation(0);
    tvParams.setTextSize(( float ) (textView.getTextSize() / scaleTimes));
    tvParams.setX(textView.getX());
    tvParams.setY(textView.getY());
    tvParams.setWidth(textView.getWidth());
    tvParams.setHeight(textView.getHeight());
    tvParams.setContent(textView.getText().toString());
    tvParams.setMidPoint(getViewMidPoint(textView));
    tvParams.setScale(1);
    tvParams.setTag(String.valueOf(( long ) textView.getTag()));
    tvParams.setRotation(mAngle);
    tvParams.setTextColor(textView.getCurrentTextColor());
    listTvParams.add(tvParams);
  }
}

相关文章

TextView类方法