本文整理了Java中android.widget.Button.setBackgroundResource()
方法的一些代码示例,展示了Button.setBackgroundResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setBackgroundResource()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:setBackgroundResource
暂无
代码示例来源:origin: sd6352051/NiftyDialogEffects
public NiftyDialogBuilder withButtonDrawable(int resid) {
mButton1.setBackgroundResource(resid);
mButton2.setBackgroundResource(resid);
return this;
}
代码示例来源:origin: aa112901/remusic
@Override
public void setBackgroundResource(int resId) {
if (mBackgroundHelper != null) {
mBackgroundHelper.setBackgroundResId(resId);
} else {
super.setBackgroundResource(resId);
}
}
代码示例来源:origin: jaydenxiao2016/AndroidFire
private void loadItem() {
//设置数据item
if (datas.size() == 1) {
Button button = getButton(datas.get(0), 0);
button.setBackgroundResource(R.drawable.selector_widget_md_single);
linearLayout.addView(button);
} else if (datas.size() > 1) {
for (int i = 0; i < datas.size(); i++) {
Button button = getButton(datas.get(i), i);
if (i == 0) {
button.setBackgroundResource(R.drawable.selector_widget_md_top);
} else if (i > 0 && i != datas.size() - 1) {
button.setBackgroundResource(R.drawable.selector_widget_md_middle);
} else {
button.setBackgroundResource(R.drawable.selector_widget_md_bottom);
}
linearLayout.addView(button);
}
}
}
代码示例来源:origin: GitLqr/LQRWeChat
@Override
public void initView() {
if (TextUtils.isEmpty(mGroupId)) {
finish();
return;
}
mBtnToolbarSend.setText(UIUtils.getString(R.string.delete));
mBtnToolbarSend.setVisibility(View.VISIBLE);
mBtnToolbarSend.setBackgroundResource(R.drawable.shape_btn_delete);
mBtnToolbarSend.setEnabled(false);
}
代码示例来源:origin: stackoverflow.com
btn.setBackgroundResource(R.drawable.button_play);
mediaPlayer.stop();
mediaPlayer.reset();
代码示例来源:origin: jaydenxiao2016/AndroidFire
button.setBackgroundResource(R.drawable.selector_widget_actiondialog_bottom);
else button.setBackgroundResource(R.drawable.selector_widget_actiondialog_single);
button.setBackgroundResource(R.drawable.selector_widget_actiondialog_top);
} else {
if (i != datas.size() - 1)
button.setBackgroundResource(R.drawable
.selector_widget_actiondialog_middle);
else
button.setBackgroundResource(R.drawable
.selector_widget_actiondialog_bottom);
代码示例来源:origin: JohnPersano/SuperToasts
button.setBackgroundResource(BackgroundUtils
.getButtonBackgroundResource(this.mStyle.frame));
button.setText(this.mStyle.buttonText != null ?
代码示例来源:origin: yuliskov/SmartYouTubeTV
protected void onButtonFocused() {
if (mTextButton != null)
mTextButton.setBackgroundResource(R.color.white_50);
if (mImageButton != null)
mImageButton.setBackgroundResource(R.color.white_50);
}
代码示例来源:origin: yuliskov/SmartYouTubeTV
protected void onButtonUnfocused() {
if (mTextButton != null)
mTextButton.setBackgroundResource(R.color.transparent);
if (mImageButton != null)
mImageButton.setBackgroundResource(R.color.transparent);
}
代码示例来源:origin: cn-ljb/rxjava_for_android
@Override
public void call(Boolean aBoolean) {
btn_login.setClickable(aBoolean);
btn_login.setBackgroundResource(aBoolean ? R.color.can_login : R.color.not_login);
}
});
代码示例来源:origin: mayubao/KuaiChuan
/**
* 设置选中View的样式
* @param isEnable
*/
private void setSelectedViewStyle(boolean isEnable){
if(isEnable){
btn_selected.setEnabled(true);
btn_selected.setBackgroundResource(R.drawable.selector_bottom_text_common);
btn_selected.setTextColor(getResources().getColor(R.color.colorPrimary));
}else{
btn_selected.setEnabled(false);
btn_selected.setBackgroundResource(R.drawable.shape_bottom_text_unenable);
btn_selected.setTextColor(getResources().getColor(R.color.darker_gray));
}
}
代码示例来源:origin: mayubao/KuaiChuan
btn_selected.setBackgroundResource(R.drawable.selector_bottom_text_common);
btn_selected.setTextColor(getResources().getColor(R.color.colorPrimary));
break;
代码示例来源:origin: iammert/MaskProgressView
@Override
public void onAnimationCompleted() {
buttonPlayPause.setBackgroundResource(R.drawable.icon_play);
}
}
代码示例来源:origin: yiwent/Mobike
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() > 0) {
mBtCoupons.setBackgroundResource(R.color.red);
} else {
mBtCoupons.setBackgroundResource(R.color.gray);
}
}
代码示例来源:origin: tvbarthel/ChaseWhisplyProject
@Override
public void onShow(DialogInterface dialog) {
Button negativeButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
negativeButton.setBackgroundResource(R.drawable.button_dialog);
Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setBackgroundResource(R.drawable.button_dialog);
}
});
代码示例来源:origin: stackoverflow.com
Button status = (Button) rowView.findViewById(R.id.image1);
status.setBackgroundResource(R.drawable.add_account);
status.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// DO your stuff
}
});
代码示例来源:origin: tvbarthel/ChaseWhisplyProject
@Override
public void onShow(DialogInterface dialog) {
Button positiveButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setBackgroundResource(R.drawable.button_dialog);
}
});
代码示例来源:origin: tvbarthel/ChaseWhisplyProject
@Override
public void onShow(DialogInterface dialog) {
Button negativeButton = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE);
negativeButton.setBackgroundResource(R.drawable.button_dialog);
}
});
代码示例来源:origin: msayan/star-dns-changer
private void serviceStopped() {
startButton.setText(R.string.start);
startButton.setBackgroundResource(R.drawable.button);
firstDnsEdit.setEnabled(true);
secondDnsEdit.setEnabled(true);
firstDnsEdit.setText("");
secondDnsEdit.setText("");
chooseButton.setEnabled(true);
chooseButton.setText(R.string.choose_dns_server);
chooseButton.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
代码示例来源:origin: 736008081/frameAndroid
private void findViewById() {
scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_layout);
scanLine = (ImageView) findViewById(R.id.capture_scan_line);
btnFlash = (Button) findViewById(R.id.btn_flash);
if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)) {
btnFlash.setBackgroundResource(R.drawable.qr_btn_flash);
} else {
btnFlash.setVisibility(View.GONE);
}
}
内容来源于网络,如有侵权,请联系作者删除!