本文整理了Java中android.widget.ImageButton.setBackgroundResource()
方法的一些代码示例,展示了ImageButton.setBackgroundResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.setBackgroundResource()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:setBackgroundResource
暂无
代码示例来源:origin: koral--/android-gif-drawable
private void postInit(GifViewUtils.GifImageViewAttributes result) {
mFreezesAnimation = result.freezesAnimation;
if (result.mSourceResId > 0) {
super.setImageResource(result.mSourceResId);
}
if (result.mBackgroundResId > 0) {
super.setBackgroundResource(result.mBackgroundResId);
}
}
代码示例来源:origin: LaiFeng-Android/SopCastComponent
@Override
public void onPublishFail() {
mProgressConnecting.setVisibility(View.GONE);
Toast.makeText(LandscapeActivity.this, "fail to publish stream", Toast.LENGTH_SHORT).show();
mRecordBtn.setBackgroundResource(R.mipmap.ic_record_start);
isRecording = false;
}
代码示例来源:origin: koral--/android-gif-drawable
@Override
public void setBackgroundResource(int resId) {
if (!GifViewUtils.setResource(this, false, resId)) {
super.setBackgroundResource(resId);
}
}
代码示例来源:origin: stackoverflow.com
float density = getContext().getResources().getDisplayMetrics().density;
mKeyHeight = (int) (56 * density);
....
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageButton b = (ImageButton) convertView;
if (b == null) {
b = new ImageButton(getContext());
b.setMinimumHeight(mKeyHeight);
b.setBackgroundResource(R.drawable.btn_keyboard_key);
b.setOnClickListener(this);
}
}
代码示例来源:origin: LaiFeng-Android/SopCastComponent
@Override
public void onDisConnected() {
mProgressConnecting.setVisibility(View.GONE);
Toast.makeText(LandscapeActivity.this, "fail to live", Toast.LENGTH_SHORT).show();
mRecordBtn.setBackgroundResource(R.mipmap.ic_record_start);
mLFLiveView.stop();
isRecording = false;
}
代码示例来源:origin: LaiFeng-Android/SopCastComponent
@Override
public void onClick(View v) {
if(isRecording) {
mProgressConnecting.setVisibility(View.GONE);
Toast.makeText(LandscapeActivity.this, "stop living", Toast.LENGTH_SHORT).show();
mRecordBtn.setBackgroundResource(R.mipmap.ic_record_start);
mLFLiveView.stop();
isRecording = false;
} else {
mUploadDialog.show();
}
}
});
代码示例来源:origin: LaiFeng-Android/SopCastComponent
@Override
public void onClick(View v) {
if(isRecording) {
mRecordBtn.setBackgroundResource(R.mipmap.ic_record_start);
mLFLiveView.stop();
isRecording = false;
} else {
mRecordBtn.setBackgroundResource(R.mipmap.ic_record_stop);
mLFLiveView.start();
isRecording = true;
}
}
});
代码示例来源:origin: LaiFeng-Android/SopCastComponent
@Override
public void onClick(View v) {
String uploadUrl = mAddressET.getText().toString();
if(TextUtils.isEmpty(uploadUrl)) {
Toast.makeText(LandscapeActivity.this, "Upload address is empty!", Toast.LENGTH_SHORT).show();
} else {
mRtmpSender.setAddress(uploadUrl);
mProgressConnecting.setVisibility(View.VISIBLE);
Toast.makeText(LandscapeActivity.this, "start connecting", Toast.LENGTH_SHORT).show();
mRecordBtn.setBackgroundResource(R.mipmap.ic_record_stop);
mRtmpSender.connect();
isRecording = true;
}
mUploadDialog.dismiss();
}
});
代码示例来源:origin: ankidroid/Anki-Android
mediaButton.setBackgroundResource(icons[1]);
setRemapButtonListener(mediaButton, i);
} else if (editModelMode && !allowFieldRemapping()) {
mediaButton.setBackgroundResource(0);
} else {
mediaButton.setBackgroundResource(icons[0]);
setMMButtonListener(mediaButton, i);
代码示例来源: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: huangfangyi/FanXin
public void togglePlayButtonIcon(int resid) {
if (mPlayPauseButton != null) {
mPlayPauseButton.setBackgroundResource(resid);
}
}
代码示例来源:origin: RWebRTC/WebRTC-Android-Learn
@Override
public void onClick(View view) {
if (scalingType == ScalingType.SCALE_ASPECT_FILL) {
videoScalingButton.setBackgroundResource(R.drawable.ic_action_full_screen);
scalingType = ScalingType.SCALE_ASPECT_FIT;
} else {
videoScalingButton.setBackgroundResource(R.drawable.ic_action_return_from_full_screen);
scalingType = ScalingType.SCALE_ASPECT_FILL;
}
callEvents.onVideoScalingSwitch(scalingType);
}
});
代码示例来源:origin: stackoverflow.com
public ImageButton initializeBtn (int resid, boolean visible) {
ImageButton btn = new ImageButton (getApplicationContext());
btn.setBackgroundResource(resid);
if (visible)
btn.setVisibility(View.VISIBLE);
else
btn.setVisibility(View.INVISIBLE);
return btn;
}
代码示例来源:origin: stackoverflow.com
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
//first get the elements by doing like
TextView note = (TextView)view.findViewById(R.id.listViewNote);
ImageView img = (ImageView) view.findViewById(R.id.listViewImg);
ImageButton likeButton = (ImageButton) convertView.findViewById(R.id.heartImage);
likeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
likeButton.setBackgroundResource(R.id.icon);
}
});
}
代码示例来源:origin: ValueYouth/RhymeMusic
private void setResource()
{
if ( application.getMediaPlayer().isPlaying() )
{
btnPlay.setBackgroundResource(R.drawable.detail_play);
}
else
{
btnPlay.setBackgroundResource(R.drawable.detail_pause);
lyricFragment.destroyRunnable();
}
}
代码示例来源:origin: easemob/kefu-android-demo
private void switchRecordBtnStatus() {
if (isDisplayRecMenu) {
recButton.setBackgroundResource(R.drawable.hd_comment_voice_btn_normal);
recorderMenu.setVisibility(View.GONE);
} else {
recButton.setBackgroundResource(R.drawable.hd_chatting_setmode_keyboard_btn_normal);
recorderMenu.setVisibility(View.VISIBLE);
hideKeyboard();
}
isDisplayRecMenu = !isDisplayRecMenu;
}
代码示例来源:origin: googlecreativelab/tunnelvision
@OnClick(R.id.filterLayout)
protected void onClickGUIToggle() {
int nextVisibility = mHorizontalScrollView.getVisibility() == View.VISIBLE ? View.GONE
: View.VISIBLE;
mCollapseButton.setBackgroundResource(
nextVisibility == View.VISIBLE ? R.drawable.collapse_arrow
: R.drawable.expand_arrow);
mHorizontalScrollView.setVisibility(nextVisibility);
}
代码示例来源:origin: vanilla-music/vanilla
/**
* Returns a new image button to be placed on the bar
*
* @param drawable The icon to use
*/
private ImageButton getImageButton(Drawable drawable) {
ImageButton button = new ImageButton(mContext);
button.setImageDrawable(drawable);
button.setBackgroundResource(R.drawable.unbound_ripple_light);
return button;
}
代码示例来源:origin: stackoverflow.com
for(int but=0; but<ClueList.size(); but++){
ImageButton clueBut = new ImageButton(this);
clueBut.setBackgroundResource(0);
clueBut.setImageBitmap(ClueList.get(but).btmp);
clueBut.setId(but);
//clueBut.setOnClickListener(this);
tr0.addView(clueBut);
}
内容来源于网络,如有侵权,请联系作者删除!