android.widget.Button.setTextSize()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(182)

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

Button.setTextSize介绍

暂无

代码示例

代码示例来源:origin: ZieIony/Carbon

@Override
public void setTextSize(int unit, float size) {
  super.setTextSize(unit, size);
  adjustTextSize();
}

代码示例来源:origin: ZieIony/Carbon

@Override
public void setTextSize(float size) {
  super.setTextSize(size);
  adjustTextSize();
}

代码示例来源:origin: Bigkoo/Android-PickerView

btnSubmit.setTextSize(mPickerOptions.textSizeSubmitCancel);
btnCancel.setTextSize(mPickerOptions.textSizeSubmitCancel);
tvTitle.setTextSize(mPickerOptions.textSizeTitle);

代码示例来源:origin: jaydenxiao2016/AndroidFire

private Button getButton(String text, int position) {
  // 动态生成选择按钮
  final Button button = new Button(mContext);
  button.setText(text);
  button.setTag(position);
  button.setTextColor(mBuilder.getItemTextColor());
  button.setTextSize(mBuilder.getItemTextSize());
  button.setLayoutParams(new LinearLayout.LayoutParams(AbsListView.LayoutParams
      .MATCH_PARENT, mBuilder.getItemHeight()));
  button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View arg0) {
      if (mBuilder.getOnItemListener() != null) {
        selectPosition = Integer.parseInt(button.getTag().toString());
        mBuilder.getOnItemListener().onItemClick(button, selectPosition);
      }
    }
  });
  return button;
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

mLeftBtn.setText(builder.getLeftButtonText());
mLeftBtn.setTextColor(builder.getLeftButtonTextColor());
mLeftBtn.setTextSize(builder.getButtonTextSize());
mRightBtn.setText(builder.getRightButtonText());
mRightBtn.setTextColor(builder.getRightButtonTextColor());
mRightBtn.setTextSize(builder.getButtonTextSize());
mSingleBtn.setText(builder.getSingleButtonText());
mSingleBtn.setTextColor(builder.getSingleButtonTextColor());
mSingleBtn.setTextSize(builder.getButtonTextSize());

代码示例来源:origin: Bigkoo/Android-PickerView

btnSubmit.setTextSize(mPickerOptions.textSizeSubmitCancel);
  btnCancel.setTextSize(mPickerOptions.textSizeSubmitCancel);
  tvTitle.setTextSize(mPickerOptions.textSizeTitle);
} else {

代码示例来源:origin: jaydenxiao2016/AndroidFire

bottomBtn.setTextSize(mBuilder.getItemTextSize());
LinearLayout.LayoutParams btnlp = new LinearLayout.LayoutParams(AbsListView.LayoutParams
    .MATCH_PARENT, mBuilder.getItemHeight());

代码示例来源:origin: jaydenxiao2016/AndroidFire

private Button getButton(String text, int position) {
  // 动态生成选择按钮
  final Button button = new Button(mContext);
  button.setText(text);
  button.setTag(position);
  button.setTextColor(mBuilder.getItemTextColor());
  button.setTextSize(mBuilder.getItemTextSize());
  LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams
      .MATCH_PARENT, mBuilder.getItemHeight());
  button.setLayoutParams(lp);
  button.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
  button.setPadding(UiUtils.dp2px(mContext,10),0,UiUtils.dp2px(mContext,10),0);
  button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View arg0) {
      if (mBuilder.getOnItemListener() != null) {
        selectPosition = Integer.parseInt(button.getTag().toString());
        mBuilder.getOnItemListener().onItemClick(button, selectPosition);
      }
    }
  });
  return button;
}

代码示例来源:origin: JohnPersano/SuperToasts

button.setTypeface(button.getTypeface(), this.mStyle.buttonTypefaceStyle);
button.setTextColor(this.mStyle.buttonTextColor);
button.setTextSize(this.mStyle.buttonTextSize);

代码示例来源:origin: ZieIony/Carbon

private void adjustTextSize() {
  if (autoSizeText == AutoSizeTextMode.None || minTextSize <= 0 || maxTextSize <= 0 || getMeasuredWidth() == 0 || getMeasuredHeight() == 0)
    return;
  if (autoSizeStepPresets == null)
    initAutoSize();
  availableSpaceRect.right = getMeasuredWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
  availableSpaceRect.bottom = getMeasuredHeight() - getCompoundPaddingBottom() - getCompoundPaddingTop();
  super.setTextSize(TypedValue.COMPLEX_UNIT_PX, binarySearch(availableSpaceRect));
}

代码示例来源:origin: brucetoo/PickView

cancelBtn=(Button)contentView.findViewById(R.id.btn_cancel);
cancelBtn.setTextColor(colorCancel);
cancelBtn.setTextSize(btnTextsize);
confirmBtn=(Button)contentView.findViewById(R.id.btn_confirm);
confirmBtn.setTextColor(colorConfirm);
confirmBtn.setTextSize(btnTextsize);
hourLoopView = (LoopView) contentView.findViewById(R.id.picker_hour);
minuteLoopView = (LoopView) contentView.findViewById(R.id.picker_minute);

代码示例来源:origin: brucetoo/PickView

cancelBtn = (Button) contentView.findViewById(R.id.btn_cancel);
cancelBtn.setTextColor(colorCancel);
cancelBtn.setTextSize(btnTextsize);
confirmBtn = (Button) contentView.findViewById(R.id.btn_confirm);
confirmBtn.setTextColor(colorConfirm);
confirmBtn.setTextSize(btnTextsize);
yearLoopView = (LoopView) contentView.findViewById(R.id.picker_year);
monthLoopView = (LoopView) contentView.findViewById(R.id.picker_month);

代码示例来源:origin: q805699513/OptionFrame

public OptionMaterialDialog setPositiveButtonTextSize(float pTextSize) {
  this.pTextSize = pTextSize;
  if (mBuilder != null && mPositiveButton != null) {
    mPositiveButton.setTextSize(pTextSize);
  }
  return this;
}

代码示例来源:origin: adolfAn/FBReader_AS

/**
 * Used by orientation change recreation
 */
private void setButtonTextSizeFloat(float buttonTextSize) {
  mButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, buttonTextSize);
}

代码示例来源:origin: wutq/AndroidModuleDemo

/**
 * 左按钮文字颜色
 *
 * @param color color
 * @return AppDialog
 */
public AppDialog setLeftButtonTextColor(int color) {
  btnLeft.setTextSize(mContext.getResources().getColor(color));
  return this;
}

代码示例来源:origin: wutq/AndroidModuleDemo

/**
 * 右按钮文字大小
 *
 * @param color color
 * @return AppDialog
 */
public AppDialog setRightButtonTextColor(int color) {
  btnRight.setTextSize(mContext.getResources().getColor(color));
  return this;
}

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Override
  public void onShow(DialogInterface dialog) {
    Button btnPositive = alert.getButton(Dialog.BUTTON_POSITIVE);
    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_SP, 35);
    Button btnNegative = alert.getButton(Dialog.BUTTON_NEGATIVE);
    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_SP, 35);
  }
});

代码示例来源:origin: mooshim/Mooshimeter-AndroidApp

@Override
  public void run() {
    float button_height = b.getHeight(); // Button height in raw pixels
    b.setTextSize(TypedValue.COMPLEX_UNIT_PX,button_height/3); // Divisor arrived at empirically
    b.setBackground(bg);
  }
});

代码示例来源:origin: ycuwq/DatePicker

@Override
  protected void initChild() {
    super.initChild();
    mCancelButton.setTextSize(mCancelButton.getTextSize() + 5);
    mDecideButton.setTextSize(mDecideButton.getTextSize() + 5);
    mDatePicker.setShowCurtain(false);
  }
}

代码示例来源:origin: AmazMod/AmazMod

public void setButtonParams(Button button, String text, Boolean mode) {
  if (mode) {
    params.setMargins(20, 12, 20, 12);
    button.setLayoutParams(params);
  }
  button.setPadding(0,15,0,15);
  button.setIncludeFontPadding(false);
  button.setMinHeight(36);
  button.setText(text);
  button.setAllCaps(true);
  button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSizeSP);
}

相关文章

Button类方法