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

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

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

TextView.getPaddingBottom介绍

暂无

代码示例

代码示例来源:origin: roughike/BottomBar

private void updateTitleBottomPadding() {
  if (isIconsOnlyMode()) {
    return;
  }
  int tabCount = getTabCount();
  if (tabContainer == null || tabCount == 0 || !isShiftingMode()) {
    return;
  }
  for (int i = 0; i < tabCount; i++) {
    BottomBarTab tab = getTabAtPosition(i);
    TextView title = tab.getTitleView();
    if (title == null) {
      continue;
    }
    int baseline = title.getBaseline();
    int height = title.getHeight();
    int paddingInsideTitle = height - baseline;
    int missingPadding = tenDp - paddingInsideTitle;
    if (missingPadding > 0) {
      title.setPadding(title.getPaddingLeft(), title.getPaddingTop(),
          title.getPaddingRight(), missingPadding + title.getPaddingBottom());
    }
  }
}

代码示例来源:origin: cpiz/BubbleView

@Override
  public int getSuperPaddingBottom() {
    return super.getPaddingBottom();
  }
}

代码示例来源:origin: ShonLin/QuickDevFramework

@Override
public int getPaddingBottom() {
  if (super.getPaddingBottom() == 0) {
    return 0;
  }
  int textLength = this.getText().length();
  if (textLength == 0) {
    return 0;
  }
  if (textLength == 1) {
    return super.getPaddingBottom() - extraPaddingVertical;
  }
  if (textLength > 1) {
    return super.getPaddingBottom() - minPaddingVertical;
  }
  return super.getPaddingBottom();
}

代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK

public void setAgencyNamePaddingRight(int paddingRight) {
    tvBestAgency.setPadding(tvBestAgency.getPaddingLeft(),
        tvBestAgency.getPaddingTop(),
        paddingRight,
        tvBestAgency.getPaddingBottom());
  }
}

代码示例来源:origin: BROUDING/SimpleDialog

private void setContent(String message, Integer paddingLeft) {
  TextView txtContent = (TextView) transitionsContainer.findViewById(R.id.txt_content);
  if( paddingLeft != null ) {
    int left   = txtContent.getPaddingLeft(),
      top    = txtContent.getPaddingTop(),
      right  = txtContent.getPaddingRight(),
      bottom = txtContent.getPaddingBottom();
    txtContent.setPadding( left +paddingLeft, top, right, bottom );
  }
  txtContent.setText(message);
}

代码示例来源:origin: geniusgithub/AndroidDialer

/**
 * Set the top padding on the header view dynamically, based on whether the header is in
 * the first row or not.
 */
public static void setHeaderViewBottomPadding(Context context, TextView textView,
    boolean isFirstRow) {
  final int topPadding;
  if (isFirstRow) {
    topPadding = (int) context.getResources().getDimension(
        R.dimen.frequently_contacted_title_top_margin_when_first_row);
  } else {
    topPadding = (int) context.getResources().getDimension(
        R.dimen.frequently_contacted_title_top_margin);
  }
  textView.setPaddingRelative(textView.getPaddingStart(), topPadding,
      textView.getPaddingEnd(), textView.getPaddingBottom());
}

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

@NonNull
private static Intent getDetailActivityStartIntent(Activity host, ArrayList<Photo> photos,
                          int position, PhotoItemBinding binding) {
  final Intent intent = new Intent(host, DetailActivity.class);
  intent.setAction(Intent.ACTION_VIEW);
  intent.putParcelableArrayListExtra(IntentUtil.PHOTO, photos);
  intent.putExtra(IntentUtil.SELECTED_ITEM_POSITION, position);
  intent.putExtra(IntentUtil.FONT_SIZE, binding.author.getTextSize());
  intent.putExtra(IntentUtil.PADDING,
      new Rect(binding.author.getPaddingLeft(),
          binding.author.getPaddingTop(),
          binding.author.getPaddingRight(),
          binding.author.getPaddingBottom()));
  intent.putExtra(IntentUtil.TEXT_COLOR, binding.author.getCurrentTextColor());
  return intent;
}

代码示例来源:origin: RuffianZhong/RWidgetHelper

@Override
  public void onGlobalLayout() {
    mView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
    mPaddingLeft = mView.getPaddingLeft();
    mPaddingRight = mView.getPaddingRight();
    mPaddingTop = mView.getPaddingTop();
    mPaddingBottom = mView.getPaddingBottom();
    setIcon();
  }
});

代码示例来源:origin: GrossumUA/TAS_Android_Boilerplate

private static void applyFixForPre21ver(TextView tv) {
    int paddingBottom = tv.getPaddingBottom();
    paddingBottom = paddingBottom - (int) tv.getLineSpacingExtra();
    tv.setPadding(tv.getPaddingLeft(), tv.getPaddingTop(), tv.getPaddingRight(), paddingBottom);
  }
}

代码示例来源:origin: googlecodelabs/android-topeka

public static void setPaddingStart(TextView target, int paddingStart) {
  ViewCompat.setPaddingRelative(target, paddingStart, target.getPaddingTop(),
      ViewCompat.getPaddingEnd(target), target.getPaddingBottom());
}

代码示例来源:origin: googlecodelabs/android-topeka

@Override
  public void setValue(TextView view, int paddingStart) {
    ViewCompat.setPaddingRelative(view, paddingStart, view.getPaddingTop(),
        ViewCompat.getPaddingEnd(view), view.getPaddingBottom());
  }
};

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

@Override
public void onSharedElementStart(List<String> sharedElementNames,
                 List<View> sharedElements,
                 List<View> sharedElementSnapshots) {
  TextView author = getAuthor();
  targetTextSize = author.getTextSize();
  targetTextColors = author.getTextColors();
  targetPadding = new Rect(author.getPaddingLeft(),
      author.getPaddingTop(),
      author.getPaddingRight(),
      author.getPaddingBottom());
  if (IntentUtil.hasAll(intent,
      IntentUtil.TEXT_COLOR, IntentUtil.FONT_SIZE, IntentUtil.PADDING)) {
    author.setTextColor(intent.getIntExtra(IntentUtil.TEXT_COLOR, Color.BLACK));
    float textSize = intent.getFloatExtra(IntentUtil.FONT_SIZE, targetTextSize);
    author.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
    Rect padding = intent.getParcelableExtra(IntentUtil.PADDING);
    author.setPadding(padding.left, padding.top, padding.right, padding.bottom);
  }
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

private boolean updateViewsWithinLayout(final int orientation,
                    final int messagePadTop, final int messagePadBottom) {
  boolean changed = false;
  if (orientation != getOrientation()) {
    setOrientation(orientation);
    changed = true;
  }
  if (mMessageView.getPaddingTop() != messagePadTop
      || mMessageView.getPaddingBottom() != messagePadBottom) {
    updateTopBottomPadding(mMessageView, messagePadTop, messagePadBottom);
    changed = true;
  }
  return changed;
}

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

private static void setLeading(TextView view, int step, int leading) {
  // This is to make the behavior more deterministic: remove extra top/bottom padding
  view.setIncludeFontPadding(false);

  // Get font metrics and calculate required inter-line extra
  Paint.FontMetricsInt metrics = view.getPaint().getFontMetricsInt();
  final int extra = leading - metrics.descent + metrics.ascent;
  view.setLineSpacing(extra, 1);

  // Determine minimum required top extra so that the view lands on the grid
  final int alignTopExtra = (step + metrics.ascent % step) % step;
  // Determine minimum required bottom extra so that view bounds are aligned with the grid
  final int alignBottomExtra = (step - metrics.descent % step) % step;

  view.setPadding(view.getPaddingLeft(), view.getPaddingTop() + alignTopExtra, view.getPaddingRight(), view.getPaddingBottom() + alignBottomExtra);
}

代码示例来源:origin: HuanHaiLiuXin/SweetTips

private boolean updateViewsWithinLayout(final int orientation,
    final int messagePadTop, final int messagePadBottom) {
  boolean changed = false;
  if (orientation != getOrientation()) {
    setOrientation(orientation);
    changed = true;
  }
  if (mMessageView.getPaddingTop() != messagePadTop
      || mMessageView.getPaddingBottom() != messagePadBottom) {
    updateTopBottomPadding(mMessageView, messagePadTop, messagePadBottom);
    changed = true;
  }
  return changed;
}

代码示例来源:origin: the-pig-of-jungle/smart-show

private boolean updateViewsWithinLayout(final int orientation,
                    final int messagePadTop, final int messagePadBottom) {
  boolean changed = false;
  if (orientation != getOrientation()) {
    setOrientation(orientation);
    changed = true;
  }
  if (mMessageView.getPaddingTop() != messagePadTop
      || mMessageView.getPaddingBottom() != messagePadBottom) {
    updateTopBottomPadding(mMessageView, messagePadTop, messagePadBottom);
    changed = true;
  }
  return changed;
}

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

private static Bitmap captureTextBitmap(TextView textView) {
  Drawable background = textView.getBackground();
  textView.setBackground(null);
  int width = textView.getWidth() - textView.getPaddingLeft() - textView.getPaddingRight();
  int height = textView.getHeight() - textView.getPaddingTop() - textView.getPaddingBottom();
  if (width == 0 || height == 0) {
    return null;
  }
  Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  canvas.translate(-textView.getPaddingLeft(), -textView.getPaddingTop());
  textView.draw(canvas);
  textView.setBackground(background);
  return bitmap;
}

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

private static Bitmap captureTextBitmap(TextView textView) {
  Drawable background = textView.getBackground();
  textView.setBackground(null);
  int width = textView.getWidth() - textView.getPaddingLeft() - textView.getPaddingRight();
  int height = textView.getHeight() - textView.getPaddingTop() - textView.getPaddingBottom();
  if (width == 0 || height == 0) {
    return null;
  }
  Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  canvas.translate(-textView.getPaddingLeft(), -textView.getPaddingTop());
  textView.draw(canvas);
  textView.setBackground(background);
  return bitmap;
}

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

public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
  }
}

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

public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
  }
}

相关文章

TextView类方法