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

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

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

TextView.getBottom介绍

暂无

代码示例

代码示例来源:origin: syncthing/syncthing-android

protected void onPostExecute(String log) {
  // Get a reference to the activity if it is still there.
  LogActivity logActivity = refLogActivity.get();
  if (logActivity == null || logActivity.isFinishing()) {
    return;
  }
  logActivity.mLog.setText(log);
  if (logActivity.mShareIntent != null) {
    logActivity.mShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, log);
  }
  // Scroll to bottom
  logActivity.mScrollView.post(() -> logActivity.mScrollView.scrollTo(0, logActivity.mLog.getBottom()));
}

代码示例来源:origin: rajeeviiit/AndroidProject

public void run() {
    scrollLogs.smoothScrollTo(0, txtLogs.getBottom());
  }
});

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

void startAnimation(){
  TextView textView1=(TextView) findViewById(R.id.textView1);
  TextView textView2=(TextView) findViewById(R.id.textView2);

  Animation animation=new TranslateAnimation(0, 0, 0, textView1.getBottom()-textView2.getBottom());
  animation.setDuration(1000);
  animation.setFillAfter(true);
  animation.setInterpolator(new BounceInterpolator());
  textView2.startAnimation(animation);
}

代码示例来源:origin: IndoorAtlas/android-sdk-examples

/**
 * Append message into log prefixing with duration since start of location requests.
 */
private void log(String msg) {
  double duration = mRequestStartTime != 0
      ? (SystemClock.elapsedRealtime() - mRequestStartTime) / 1e3
      : 0d;
  mLog.append(String.format(Locale.US, "\n[%06.2f]: %s", duration, msg));
  mScrollView.smoothScrollBy(0, mLog.getBottom());
}

代码示例来源:origin: IndoorAtlas/android-sdk-examples

/**
 * Append message into log prefixing with duration since start of location requests.
 */
private void log(String msg) {
  double duration = mRequestStartTime != 0
      ? (SystemClock.elapsedRealtime() - mRequestStartTime) / 1e3
      : 0d;
  mLog.append(String.format(Locale.US, "\n[%06.2f]: %s", duration, msg));
  mScrollView.smoothScrollBy(0, mLog.getBottom());
}

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

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

代码示例来源:origin: guanpj/JReadHub

@Override
public void initDataAndEvent() {
  mToolbar.setNavigationOnClickListener(v -> pop());
  mToolbar.setOnMenuItemClickListener(this);
  mTimelineAdapter = new TopicTimelineAdapter(getContext());
  mRecyclerTimeline.setAdapter(mTimelineAdapter);
  mRecyclerTimeline.setLayoutManager(new LinearLayoutManager(getContext()));
  mRecyclerTimeline.setNestedScrollingEnabled(false);
  mScrollView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
    if (scrollY > mTxtTopicTime.getBottom()) {
      mToolbarHeader.setVisibility(View.VISIBLE);
      mToolbar.setTitle("");
    } else {
      mToolbarHeader.setVisibility(View.GONE);
      mToolbar.setTitle(getText(R.string.menu_topic_detail));
    }
  });
}

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

final ScrollView scrollView = (ScrollView) findViewById(R.id.consoleTab);
TextView textView = (TextView) findViewById(R.id.consoleView);
boolean autoScroll = (textView.getBottom() - (scrollView.getHeight() + scrollView.getScrollY())) <= 0;
textView.setText(state.getConsole().getText());

if (autoScroll) {
  scrollView.post(new Runnable() {
   public void run() {
     scrollView.fullScroll(ScrollView.FOCUS_DOWN);
   }
  });
}

代码示例来源:origin: tyrex-team/senslogs

int heightDiff = newHeight - oldHeight;
textView.layout(textView.getLeft() - widthDiff / 2, textView.getTop() - heightDiff / 2,
    textView.getRight() + widthDiff / 2, textView.getBottom() + heightDiff / 2);

代码示例来源: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: smartown/TableLayout

public void onClick(float y) {
  int childCount = getChildCount();
  for (int i = 0; i < childCount; i++) {
    TextView textView = (TextView) getChildAt(i);
    if (textView.getBottom() >= y) {
      if (i == 0) {
        return;
      }
      textView.setSelected(!textView.isSelected());
      textView.setBackgroundColor(textView.isSelected() ? callback.getTableLayout().getBackgroundColorSelected() : Color.TRANSPARENT);
      textView.setTextColor(textView.isSelected() ? callback.getTableLayout().getTableTextColorSelected() : callback.getTableLayout().getTableTextColor());
      return;
    }
  }
}

代码示例来源:origin: canceel/flexboxlayout

@Test
@FlakyTest(tolerance = TOLERANCE)
public void testAlignItems_baseline_wrapReverse() throws Throwable {
  final FlexboxTestActivity activity = mActivityRule.getActivity();
  mActivityRule.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      activity.setContentView(R.layout.activity_align_items_baseline_test);
      FlexboxLayout flexboxLayout = (FlexboxLayout) activity
          .findViewById(R.id.flexbox_layout);
      flexboxLayout.setFlexWrap(FlexboxLayout.FLEX_WRAP_WRAP_REVERSE);
    }
  });
  InstrumentationRegistry.getInstrumentation().waitForIdleSync();
  TextView textView1 = (TextView) activity.findViewById(R.id.text1);
  TextView textView2 = (TextView) activity.findViewById(R.id.text2);
  TextView textView3 = (TextView) activity.findViewById(R.id.text3);
  int bottomPluBaseline1 = textView1.getBottom() + textView1.getBaseline();
  int bottomPluBaseline2 = textView2.getBottom() + textView2.getBaseline();
  int bottomPluBaseline3 = textView3.getBottom() + textView3.getBaseline();
  assertThat(bottomPluBaseline1, is(bottomPluBaseline2));
  assertThat(bottomPluBaseline2, is(bottomPluBaseline3));
}

代码示例来源:origin: canceel/flexboxlayout

@Test
@FlakyTest(tolerance = TOLERANCE)
public void testAlignContent_flexEnd() throws Throwable {
  final FlexboxTestActivity activity = mActivityRule.getActivity();
  mActivityRule.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      activity.setContentView(R.layout.activity_align_content_test);
      FlexboxLayout flexboxLayout = (FlexboxLayout) activity
          .findViewById(R.id.flexbox_layout);
      flexboxLayout.setAlignContent(FlexboxLayout.ALIGN_CONTENT_FLEX_END);
    }
  });
  FlexboxLayout flexboxLayout = (FlexboxLayout) activity.findViewById(R.id.flexbox_layout);
  assertThat(flexboxLayout.getAlignContent(), is(FlexboxLayout.ALIGN_CONTENT_FLEX_END));
  onView(withId(R.id.text3)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
  onView(withId(R.id.text3)).check(isBottomAlignedWith(withId(R.id.flexbox_layout)));
  onView(withId(R.id.text1)).check(isAbove(withId(R.id.text3)));
  onView(withId(R.id.text1)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
  onView(withId(R.id.text2)).check(isAbove(withId(R.id.text3)));
  TextView textView1 = (TextView) activity.findViewById(R.id.text1);
  TextView textView3 = (TextView) activity.findViewById(R.id.text3);
  assertThat(textView1.getBottom(), is(flexboxLayout.getBottom() - textView3.getHeight()));
}

相关文章

TextView类方法