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

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

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

TextView.getLeft介绍

暂无

代码示例

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

/**
 * rate从零到1
 */
@Override
public void duringAnimation(float rate) {
  textView1.setAlpha(1 - rate);
  textView2.setAlpha(rate);
  if (nextPosition > currentPosition) {
    textView1.offsetLeftAndRight((int) (leftMargin - leftDistance * rate - textView1.getLeft()));
    textView2.offsetLeftAndRight((int) (leftMargin + rightDistance * (1 - rate) - textView2.getLeft()));
  } else {
    textView1.offsetLeftAndRight((int) (leftMargin + rightDistance * rate - textView1.getLeft()));
    textView2.offsetLeftAndRight((int) (leftMargin * rate - textView2.getLeft()));
  }
}

代码示例来源:origin: rey5137/material

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
  super.onSizeChanged(w, h, oldw, oldh);
  TextView tv = getTabView(mSelectedPosition);
  if(tv != null)
    updateIndicator(tv.getLeft(), tv.getMeasuredWidth());
}

代码示例来源:origin: rey5137/material

@Override
public void onPageScrollStateChanged(int state) {
  if(state == ViewPager.SCROLL_STATE_IDLE){
    mScrolling = false;
    TextView tv = getTabView(mSelectedPosition);
    if(tv != null) {
      updateIndicator(tv.getLeft(), tv.getMeasuredWidth());
    }
  }
  else
    mScrolling = true;
  if (mListener != null)
    mListener.onPageScrollStateChanged(state);
}

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

TextView textview = (TextView)findViewbyId(R.id.textview1);
 int x1=textview.getLeft();  
 int y1=textview.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: 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: Karumi/Dividers

@Override void updateTextPositions(int position, float positionOffset, boolean force) {
  final Rect r = mTempRect;
  int bottom = getHeight();
  int left = mCurrText.getLeft() - mTabPadding;
  int right = mCurrText.getRight() + mTabPadding;
  int top = bottom - mIndicatorHeight;

  r.set(left, top, right, bottom);

  super.updateTextPositions(position, positionOffset, force);
  mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF);

  left = mCurrText.getLeft() - mTabPadding;
  right = mCurrText.getRight() + mTabPadding;
  r.union(left, top, right, bottom);

  invalidate(r);
 }
}

代码示例来源:origin: Karumi/Dividers

@Override protected void onDraw(Canvas canvas) {
 super.onDraw(canvas);
 final int height = getHeight();
 final int bottom = height;
 final int left = mCurrText.getLeft() - mTabPadding;
 final int right = mCurrText.getRight() + mTabPadding;
 final int top = bottom - mIndicatorHeight;
 mTabPaint.setColor(mTabAlpha << 24 | (mIndicatorColor & 0xFFFFFF));
 canvas.drawRect(left, top, right, bottom, mTabPaint);
 if (mDrawFullUnderline) {
  mTabPaint.setColor(0xFF << 24 | (mIndicatorColor & 0xFFFFFF));
  canvas.drawRect(getPaddingLeft(), height - mFullUnderlineHeight,
    getWidth() - getPaddingRight(), height, mTabPaint);
 }
}

代码示例来源:origin: kingargyle/adt-leanback-support

@Override
  void updateTextPositions(int position, float positionOffset, boolean force) {
    final Rect r = mTempRect;
    int bottom = getHeight();
    int left = mCurrText.getLeft() - mTabPadding;
    int right = mCurrText.getRight() + mTabPadding;
    int top = bottom - mIndicatorHeight;

    r.set(left, top, right, bottom);

    super.updateTextPositions(position, positionOffset, force);
    mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF);

    left = mCurrText.getLeft() - mTabPadding;
    right = mCurrText.getRight() + mTabPadding;
    r.union(left, top, right, bottom);

    invalidate(r);
  }
}

代码示例来源: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: kingargyle/adt-leanback-support

@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  final int height = getHeight();
  final int bottom = height;
  final int left = mCurrText.getLeft() - mTabPadding;
  final int right = mCurrText.getRight() + mTabPadding;
  final int top = bottom - mIndicatorHeight;
  mTabPaint.setColor(mTabAlpha << 24 | (mIndicatorColor & 0xFFFFFF));
  canvas.drawRect(left, top, right, bottom, mTabPaint);
  if (mDrawFullUnderline) {
    mTabPaint.setColor(0xFF << 24 | (mIndicatorColor & 0xFFFFFF));
    canvas.drawRect(getPaddingLeft(), height - mFullUnderlineHeight,
        getWidth() - getPaddingRight(), height, mTabPaint);
  }
}

代码示例来源: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);
}

代码示例来源:origin: pinguo-zhouwei/EasyBlur

@Override
  public boolean onPreDraw() {
    mImageBg.getViewTreeObserver().removeOnPreDrawListener(this);
    mImageBg.buildDrawingCache();
    Bitmap bmp = mImageBg.getDrawingCache();
    Bitmap overlay = Bitmap.createBitmap((int) (view.getMeasuredWidth()),
        (int) (view.getMeasuredHeight()), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(overlay);
    canvas.translate(-view.getLeft(), -view.getTop());
    canvas.drawBitmap(bmp, 0, 0, null);
    Bitmap finalBitmap = EasyBlur.with(MainActivity.this)
        .bitmap(overlay) //要模糊的图片
        .radius(10)//模糊半径
        .blur();
    view.setBackground(new BitmapDrawable(
        getResources(), finalBitmap));
    return true;
  }
});

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

private void subAnim(){
  ViewAnimator.animate(sub)
      .translationX(0, addbutton.getLeft() - sub.getLeft())
      .rotation(-360)
      .alpha(255, 0)
      .duration(300)
      .interpolator(new AccelerateInterpolator())
      .andAnimate(tv_count)
      .onStop(new AnimationListener.Stop() {
        @Override
        public void onStop() {
          if (circle_anim) {
            addbutton.expendAnim();
          }
        }
      })
      .translationX(0, addbutton.getLeft() - tv_count.getLeft())
      .rotation(-360)
      .alpha(255, 0)
      .interpolator(new AccelerateInterpolator())
      .duration(300)
      .start()
  ;
}

相关文章

TextView类方法