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

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

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

TextView.getTop介绍

暂无

代码示例

代码示例来源:origin: xmuSistone/AndroidPileLayout

/**
 * rate从零到1
 */
@Override
public void duringAnimation(float rate) {
  textView1.setAlpha(1 - rate);
  textView2.setAlpha(rate);
  if (nextPosition > currentPosition) {
    textView1.offsetTopAndBottom((int) (0 - verticalDistance * rate - textView1.getTop()));
    textView2.offsetTopAndBottom((int) (0 + verticalDistance * (1 - rate) - textView2.getTop()));
  } else {
    textView1.offsetTopAndBottom((int) (0 + verticalDistance * rate - textView1.getTop()));
    textView2.offsetTopAndBottom((int) (0 - verticalDistance * (1 - rate) - textView2.getTop()));
  }
}

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

@Override
  public void onScrollChanged(int height) {
    if(titleTop == 0){
      titleTop = tv_title.getTop();
    }
    Log.i("sacaasdas","onScrollChanged:" + height + "   titleTop:" + titleTop + "  tv_title.getTop():" + tv_title.getTop());
  }
});

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

@Override
  public void onHeaderTranslationY(float translationY) {
    Log.i("asdasdasd","translationY:" + translationY + "   tv_headertitle.top:" + tv_headertitle.getTop());
  }
});

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

@Override
  public void run() {
    Log.i("asdasdasd","tv_title.getTop():" + tv_title.getTop());
  }
},5000);

代码示例来源: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: stackoverflow.com

final View rootView = inflater.inflate(R.layout.fragment_snakes, container, false);
Button button = (Button) rootView.findViewById(R.id.Button1);
TextView paragraph1 = (TextView) rootView.findViewById(R.id.TextView1);
ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.ScrollView);
button.setOnClickListener(new OnClickListener() {
  public void onClick(final View v) {
    scrollView.smoothScrollTo(0,paragraph1.getTop());
  }
});

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

TextView textview = (TextView)findViewbyId(R.id.textview1);
 int x1=textview.getLeft();  
 int y1=textview.getTop();

代码示例来源:origin: Popalay/Tutors

@Override
public void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  if (bitmap == null) {
    return;
  }
  canvas.drawBitmap(this.bitmap, this.x, this.y, holePaint);
  final boolean inTop = inTop();
  final float lineX = this.x + this.bitmap.getWidth() / 2;
  final float lineY = this.y + (inTop ? this.bitmap.getHeight() + spacing : -spacing);
  final float lineYEnd = inTop ? this.text.getTop() - spacing : text.getBottom() + spacing;
  canvas.drawLine(lineX, lineY, lineX, lineYEnd, paint);
}

代码示例来源:origin: AppLozic/Applozic-Android-SDK

@Override
  public void run() {
    nestedScrollView.scrollTo(nestedScrollView.getLeft(), groupParticipantsTexView.getTop());
  }
});

代码示例来源:origin: CoderGuoy/Coder

/**
   * @param view
   * @param interpolator
   */
  private void setCurvedMotion(TextView view, int interpolator) {
    path = new Path();
    path.moveTo(view.getLeft(), view.getTop());
    path.lineTo(view.getLeft(), 600);
    animator = new ObjectAnimator().ofFloat(view, View.X, View.Y, path);
    animator.setInterpolator(new AnimationUtils().loadInterpolator(
        this, interpolator));
    animator.setDuration(2000);
    animator.start();
  }
}

代码示例来源:origin: BaaSBeginner/leanchat-android

@Override
 public boolean onTouch(View v, MotionEvent event) {
  int x = Math.round(event.getX());
  int y = Math.round(event.getY());
  for (int i = 0; i < getChildCount(); i++) {
   TextView child = (TextView) getChildAt(i);
   if (y > child.getTop() && y < child.getBottom()) {
    MemberLetterEvent letterEvent = new MemberLetterEvent();
    letterEvent.letter = child.getText().toString().charAt(0);
    EventBus.getDefault().post(letterEvent);
   }
  }
  return true;
 }
});

代码示例来源:origin: 103style/SpeedControl

@Override
  public void run() {
    tvLeft = textView.getLeft();
    tvTop = textView.getTop();
    tvRight = textView.getRight();
    tvBottom = textView.getBottom();
    first = false;
    textView.setText(tvLeft + "," + tvTop + "," + tvRight + "," + tvBottom);
  }
});

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

private static void setTextViewData(TextView view, TextResizeData data, float fontSize) {
  view.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
  view.setPadding(data.paddingLeft, data.paddingTop, data.paddingRight, data.paddingBottom);
  view.setRight(view.getLeft() + data.width);
  view.setBottom(view.getTop() + data.height);
  view.setTextColor(data.textColor);
  int widthSpec = View.MeasureSpec.makeMeasureSpec(view.getWidth(), View.MeasureSpec.EXACTLY);
  int heightSpec = View.MeasureSpec.makeMeasureSpec(view.getHeight(), View.MeasureSpec.EXACTLY);
  view.measure(widthSpec, heightSpec);
  view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
}

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

TextView tv = (TextView)findViewById(R.id.textView1);
Rect bounds = new Rect(tv.getLeft(), tv.getTop(), tv.getRight(), tv.getBottom());

代码示例来源:origin: DroidsOnRoids/Workcation

private static void setTextViewData(TextView view, TextResizeData data, float fontSize) {
  view.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
  view.setPadding(data.paddingLeft, data.paddingTop, data.paddingRight, data.paddingBottom);
  view.setRight(view.getLeft() + data.width);
  view.setBottom(view.getTop() + data.height);
  view.setTextColor(data.textColor);
  int widthSpec = View.MeasureSpec.makeMeasureSpec(view.getWidth(), View.MeasureSpec.EXACTLY);
  int heightSpec = View.MeasureSpec.makeMeasureSpec(view.getHeight(), View.MeasureSpec.EXACTLY);
  view.measure(widthSpec, heightSpec);
  view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
}

代码示例来源:origin: wangxp423/ViewExercise

private void invisible() {
  int cx = (ivMeinv.getLeft() + ivMeinv.getRight()) / 2;
  int cy = (ivMeinv.getTop() + ivMeinv.getBottom()) / 2;
  int initialRadius = ivMeinv.getWidth();
  Animator anim = ViewAnimationUtils.createCircularReveal(ivMeinv, cx, cy, initialRadius, 0);
  anim.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      ivMeinv.setVisibility(View.INVISIBLE);
    }
  });
  anim.start();
}

代码示例来源:origin: wangxp423/ViewExercise

private void visible() {
  int cx = (ivMeinv.getLeft() + ivMeinv.getRight()) / 2;
  int cy = (ivMeinv.getTop() + ivMeinv.getBottom()) / 2;
  int initialRadius = ivMeinv.getWidth() + ivMeinv.getHeight();
  Animator anim = ViewAnimationUtils.createCircularReveal(ivMeinv, cx, cy, 0, initialRadius);
  ivMeinv.setVisibility(View.VISIBLE);
  anim.start();
}

代码示例来源:origin: TMLAndroid/FillBlankDemo

public void setEtXY( RectF rf) {
  //设置et w,h的值
  RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mEt.getLayoutParams();
  lp.width = (int)(rf.right - rf.left);
  lp.height = (int)(rf.bottom - rf.top);
  //设置et 相对于tv x,y的相对位置
  lp.leftMargin = (int) (mTv.getLeft()+rf.left);
  lp.topMargin  = (int) (mTv.getTop()+rf.top);
  mEt.setLayoutParams(lp);
  //获取焦点,弹出软键盘
  mEt.setFocusable(true);
  mEt.requestFocus();
  showImm(true,mEt);
}

代码示例来源:origin: xiangzhihong/gpuImage

private boolean checkMargin() {
  if (!rectFAll.contains(localRectF2)) {
    return false;
  }
  for (TextView textView : tvs) {
    if (!rectFAll.contains(textView.getLeft(), textView.getTop(), textView.getRight(), textView.getBottom())) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: rockon999/LeanbackLauncher

private void scaleExpandedInfoAreaView(TextView view) {
  view.setPivotX((float) (-view.getLeft()));
  view.setPivotY((float) (-(view.getTop() - this.mInfoAreaTop)));
  view.setScaleX(1.0f / this.mScaleFactor);
  view.setScaleY(1.0f / this.mScaleFactor);
}

相关文章

TextView类方法