android.widget.ImageButton.setBackgroundDrawable()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(150)

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

ImageButton.setBackgroundDrawable介绍

暂无

代码示例

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

private void hookupButtons(final Context context) {
  ImageButton playlistsBtn = (ImageButton)findViewById(R.id.nav_playlists_btn);
  if (context instanceof PlaylistsActivity) {
    playlistsBtn.setBackgroundDrawable(getResources().getDrawable(R.drawable.nav_playlists_active));
  } else {
    playlistsBtn.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        Intent i = new Intent(context, PlaylistsActivity.class);
        i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        context.startActivity(i);
      }
    });
  }
}

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

ImageButton imageButton = new ImageButton(this);
imageButton.setBackgroundDrawable(null);

代码示例来源:origin: rtoshiro/FullscreenVideoView

protected void updateControls() {
  if (imgplay == null) return;
  Drawable icon;
  if (getCurrentState() == State.STARTED) {
    icon = context.getResources().getDrawable(R.drawable.fvl_selector_pause);
  } else {
    icon = context.getResources().getDrawable(R.drawable.fvl_selector_play);
  }
  imgplay.setBackgroundDrawable(icon);
}

代码示例来源:origin: bitcraze/crazyflie-android-client

@Override
  public void run() {
    mToggleConnectButton.setBackgroundDrawable(getResources().getDrawable(drawable));
  }
});

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

ImageButton mImageButton = new ImageButton(context);
mImageButton.setImageResource(R.drawable.close_button);
RelativeLayout.LayoutParams paramsB = new RelativeLayout.LayoutParams(width, height);
paramsB.addRule(RelativeLayout.ALIGN_PARENT_TOP);
paramsB.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
mImageButton.setLayoutParams(paramsB);
mImageButton.setAdjustViewBounds(true);
mImageButton.setBackgroundDrawable(null);
mRelativeLayout.addView(mImageButton);
mImageButton.setScaleType(ImageView.ScaleType.FIT_CENTER);

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

/**
 */
@Override
@SuppressWarnings("deprecation")
public void setBackgroundDrawable(Drawable background) {
  super.setBackgroundDrawable(background);
  this.ensureDecorator();
  mDecorator.applyBackgroundTint();
}

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

/**
 */
@Override
@SuppressWarnings("deprecation")
public void setBackgroundDrawable(Drawable background) {
  super.setBackgroundDrawable(background);
  this.ensureDecorator();
  mDecorator.applyBackgroundTint();
}

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

/**
 */
@Override
@SuppressWarnings("deprecation")
public void setBackgroundDrawable(Drawable background) {
  super.setBackgroundDrawable(background);
  this.ensureDecorator();
  mDecorator.applyBackgroundTint();
}

代码示例来源:origin: laizimo/richeditor

@NonNull
@Override
public ImageButton createView() {
  ImageButton imageView = new ImageButton(getContext());
  if(!enableAutoSet) {
    TypedArray typedArray = getContext().obtainStyledAttributes(new int[]{R.attr.selectableItemBackgroundBorderless});
    Drawable drawable = typedArray.getDrawable(0);
    imageView.setBackgroundDrawable(drawable);
    typedArray.recycle();
  }else
    imageView.setBackgroundDrawable(null);
  imageView.setImageResource(idRes);
  imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
  imageView.setPadding(12, 32, 12, 32);
  return imageView;
}

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

ImageButton myButton = new ImageButton(this);
myButton.setBackgroundDrawable(demoCoverImage);
LayoutParams lp = new LayoutParams(70, 60);
ll.addView(myButton, lp);

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

Bitmap imgBitmap = android.provider.MediaStore.Images.Media.getBitmap(objContentResolver, imageUri);
Drawable imgDrawable = new BitmapDrawable(imgBitmap);
btnSubmit.setBackgroundDrawable(imgDrawable);

代码示例来源:origin: sh3lan93/CounterView

this.rootView.setBackgroundDrawable(this.viewBackground);
if (this.incDecBackground != null){
  this.incButton.setBackgroundDrawable(this.incDecBackground);
  this.decButton.setBackgroundDrawable(this.incDecBackground);

代码示例来源:origin: appnexus/mobile-sdk-android

refresh.setBackground(style.refreshButton);
} else {
  back.setBackgroundDrawable(style.backButton);
  forward.setBackgroundDrawable(style.forwardButton);
  refresh.setBackgroundDrawable(style.refreshButton);

代码示例来源:origin: AlexMofer/ProjectX

a.recycle();
} else {
  mButton.setBackgroundDrawable(background);

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

coverImage.setId(plastic_randomNum + position);
coverImage.setPadding(5,3,6,7);
coverImage.setBackgroundDrawable(null);

相关文章

ImageButton类方法