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

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

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

Button.setCompoundDrawables介绍

暂无

代码示例

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

@Override
public void setCompoundDrawables(@Nullable Drawable left, @Nullable Drawable top, @Nullable Drawable right, @Nullable Drawable bottom) {
  super.setCompoundDrawables(left, top, right, bottom);
  updateTint();
}

代码示例来源:origin: ybq/Android-SpinKit

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  //ProgressBar
  ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress);
  DoubleBounce doubleBounce = new DoubleBounce();
  doubleBounce.setBounds(0, 0, 100, 100);
  doubleBounce.setColor(colors[7]);
  progressBar.setIndeterminateDrawable(doubleBounce);
  //Button
  Button button = (Button) view.findViewById(R.id.button);
  mWaveDrawable = new Wave();
  mWaveDrawable.setBounds(0, 0, 100, 100);
  //noinspection deprecation
  mWaveDrawable.setColor(getResources().getColor(R.color.colorAccent));
  button.setCompoundDrawables(mWaveDrawable, null, null, null);
  //TextView
  TextView textView = (TextView) view.findViewById(R.id.text);
  mCircleDrawable = new Circle();
  mCircleDrawable.setBounds(0, 0, 100, 100);
  mCircleDrawable.setColor(Color.WHITE);
  textView.setCompoundDrawables(null, null, mCircleDrawable, null);
  textView.setBackgroundColor(colors[2]);
  //ImageView
  ImageView imageView = (ImageView) view.findViewById(R.id.image);
  mChasingDotsDrawable = new ChasingDots();
  mChasingDotsDrawable.setColor(Color.WHITE);
  imageView.setImageDrawable(mChasingDotsDrawable);
  imageView.setBackgroundColor(colors[0]);
}

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

/**
 * 设置标题
 *
 * @param title
 */
public void setTitle(String title, boolean flag) {
  mTitle.setText(title);
  if (flag) {
    mBtnLeft.setCompoundDrawables(null, null, null, null);
  } else {
    mBtnLeft.setCompoundDrawables(mBtnBackDrawable, null, null, null);
  }
}

代码示例来源:origin: scoutant/blokish

private void setButtonImage( AlertDialog dialog, int buttonId, int id ) {
    Button button = dialog.getButton( buttonId);
    Drawable drawable = getResources().getDrawable( id);
    drawable.setBounds(drawable.getIntrinsicWidth()/4, 0, drawable.getIntrinsicWidth()*3/4, drawable.getIntrinsicHeight()/2);
    button.setCompoundDrawables(drawable, null, null, null);
//        button.setBackgroundColor(Color.TRANSPARENT);
  }

代码示例来源:origin: msayan/star-dns-changer

private void serviceStarted() {
  startButton.setText(R.string.stop);
  startButton.setBackgroundResource(R.drawable.button_red);
  firstDnsEdit.setEnabled(false);
  secondDnsEdit.setEnabled(false);
  chooseButton.setEnabled(false);
  Drawable drawable = ContextCompat.getDrawable(this, R.drawable.ic_vpn_key_black_24dp);
  drawable.setBounds(40, 0, drawable.getIntrinsicHeight() + 40, drawable.getIntrinsicWidth());
  chooseButton.setCompoundDrawables(drawable, null, null, null);
}

代码示例来源:origin: SwiftyWang/FingerColoring-Android

protected void showTwoImageDialog(StringBuffer buffer, Drawable resId1, String s1, Drawable resId2, String s2, View.OnClickListener listener1, View.OnClickListener listener2, boolean b) {
    dialog.setCancelable(b);
    View detail_layout = View.inflate(
        context,
        R.layout.dialog_two_button, null);
    dialog.setContentView(detail_layout);
    TextView content = (TextView) detail_layout.findViewById(R.id.content);
    content.setText(buffer);
    Button button1 = (Button) detail_layout.findViewById(R.id.button1);
    Button button2 = (Button) detail_layout.findViewById(R.id.button2);
    resId1.setBounds(0, 0, DensityUtil.dip2px(context, 40), DensityUtil.dip2px(context, 40));
    resId2.setBounds(0, 0, DensityUtil.dip2px(context, 40), DensityUtil.dip2px(context, 40));
    button1.setCompoundDrawables(null, resId1, null, null);
    button2.setCompoundDrawables(null, resId2, null, null);
    button1.setText(s1);
    button1.setTextColor(context.getResources().getColor(R.color.maincolor));
    button2.setText(s2);
    button2.setTextColor(context.getResources().getColor(R.color.maincolor));
    button1.setOnClickListener(listener1);
    button2.setOnClickListener(listener2);
    showDialog();
  }
}

代码示例来源:origin: com.albedinsky.android/ui-widget-common

/**
 */
@Override
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
  super.setCompoundDrawables(left, top, right, bottom);
  this.ensureDecorator();
  mDecorator.applyCompoundDrawablesTint();
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 */
@Override
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
  super.setCompoundDrawables(left, top, right, bottom);
  this.ensureDecorator();
  mDecorator.applyCompoundDrawablesTint();
}

代码示例来源:origin: pranavpandey/dynamic-support

if (mButtonPositiveIcon != null) {
  mButtonPositiveIcon.setBounds(0, 0, mButtonIconDimen, mButtonIconDimen);
  mButtonPositive.setCompoundDrawables(mButtonPositiveIcon, null, null, null);
if (mButtonNegativeIcon != null) {
  mButtonNegativeIcon.setBounds(0, 0, mButtonIconDimen, mButtonIconDimen);
  mButtonNegative.setCompoundDrawables(mButtonNegativeIcon, null, null, null);
if (mButtonPositiveIcon != null) {
  mButtonPositiveIcon.setBounds(0, 0, mButtonIconDimen, mButtonIconDimen);
  mButtonPositive.setCompoundDrawables(mButtonPositiveIcon, null, null, null);

代码示例来源:origin: xbmc/Kore

next.setCompoundDrawables(null, null, null, null);
next.setOnClickListener(new View.OnClickListener() {
  @Override

代码示例来源:origin: Sonelli/juicessh-performancemonitor

(int)(drawable.getIntrinsicHeight()*0.2));
connectButton.setCompoundDrawables(drawable, null, null, null);
connectButton.setOnClickListener(new View.OnClickListener() {
  @Override
      (int)(drawable1.getIntrinsicHeight()*0.2));
disconnectButton.setCompoundDrawables(drawable1, null, null, null);
this.disconnectButton.setOnClickListener(new View.OnClickListener() {
  @Override

相关文章

Button类方法