本文整理了Java中android.widget.ImageButton.getBackground()
方法的一些代码示例,展示了ImageButton.getBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.getBackground()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:getBackground
暂无
代码示例来源:origin: facebook/facebook-android-sdk
private ShareOpenGraphAction getThrowAction() {
// The OG objects have their own bitmaps we could rely on, but in order to demonstrate
// attaching an in-memory bitmap (e.g., a game screencap) we'll send the bitmap explicitly
// ourselves.
ImageButton view = gestureImages[playerChoice];
BitmapDrawable drawable = (BitmapDrawable) view.getBackground();
final Bitmap bitmap = drawable.getBitmap();
return new ShareOpenGraphAction.Builder()
.setActionType(OpenGraphConsts.THROW_ACTION_TYPE)
.putString("fb_sample_rps:gesture", getBuiltInGesture(playerChoice))
.putString("fb_sample_rps:opposing_gesture", getBuiltInGesture(computerChoice))
.putPhotoArrayList("og:image", new ArrayList<SharePhoto>() {{
add(new SharePhoto.Builder().setBitmap(bitmap).build());
}})
.build();
}
代码示例来源:origin: com.albedinsky.android/ui-widget-common
/**
* <b>Note, that on pre {@link android.os.Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android versions
* this method will return an instance of {@link TintDrawable TintDrawable} if tint has been applied
* via {@link #setBackgroundTintList(ColorStateList)}.</b>
* <p>
* The original wrapped background drawable can be obtained via {@link TintDrawable#getDrawable()}.
*/
@Override
public Drawable getBackground() {
return super.getBackground();
}
代码示例来源:origin: com.albedinsky.android/ui
/**
* <b>Note, that on pre {@link android.os.Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android versions
* this method will return an instance of {@link TintDrawable TintDrawable} if tint has been applied
* via {@link #setBackgroundTintList(ColorStateList)}.</b>
* <p>
* The original wrapped background drawable can be obtained via {@link TintDrawable#getDrawable()}.
*/
@Override
public Drawable getBackground() {
return super.getBackground();
}
代码示例来源:origin: com.albedinsky.android/ui-widget-image
/**
* <b>Note, that on pre {@link android.os.Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android versions
* this method will return an instance of {@link TintDrawable TintDrawable} if tint has been applied
* via {@link #setBackgroundTintList(ColorStateList)}.</b>
* <p>
* The original wrapped background drawable can be obtained via {@link TintDrawable#getDrawable()}.
*/
@Override
public Drawable getBackground() {
return super.getBackground();
}
代码示例来源:origin: PuffOpenSource/Puff-Android
private void updateButtonSkipDrawable() {
if (skipEnabled) {
buttonSkip.setImageResource(R.drawable.ic_skip);
} else {
buttonSkip.setImageResource(R.drawable.ic_previous);
buttonSkip.getBackground().setAlpha(50);
}
}
代码示例来源:origin: PuffOpenSource/Puff-Android
private void updateButtonNextDrawable() {
float offset = 0;
if (finishEnabled && position + positionOffset >= adapter.getCount() - 2) {
offset = Math.min(position + positionOffset - adapter.getCount() + 2, 1);
}
if (offset <= 0) {
buttonNext.setImageResource(R.drawable.ic_next);
buttonNext.getBackground().setAlpha(50);
} else {
buttonNext.setImageResource(offset > 0 ? R.drawable.ic_finish : R.drawable.ic_next);
buttonNext.getBackground().mutate().setAlpha(50);
}
}
代码示例来源:origin: stackoverflow.com
ImageButton mButton = new ImageButton(this);
Drawable drawable = mButton.getBackground();
champs.setImageDrawable(drawable)
代码示例来源:origin: apps4av/avare
@Override
public boolean onLongClick(View v) {
// long press on center button sets track toggle
mPref.setTrackUpPlates(!mPref.isTrackUpPlates());
if (mPref.isTrackUpPlates()) {
mCenterButton.getBackground().setColorFilter(0xFF71BC78, PorterDuff.Mode.MULTIPLY);
mToast.setText(getString(R.string.TrackUp));
} else {
mCenterButton.getBackground().setColorFilter(0xFF444444, PorterDuff.Mode.MULTIPLY);
mToast.setText(getString(R.string.NorthUp));
}
mToast.show();
mPlatesView.invalidate();
return true;
}
});
代码示例来源:origin: apps4av/avare
@Override
public boolean onLongClick(View v) {
// long press on center button sets track toggle
mPref.setTrackUp(!mPref.isTrackUp());
if(mPref.isTrackUp()) {
mCenterButton.getBackground().setColorFilter(0xFF71BC78, PorterDuff.Mode.MULTIPLY);
mToast.setText(getString(R.string.TrackUp));
}
else {
mCenterButton.getBackground().setColorFilter(0xFF444444, PorterDuff.Mode.MULTIPLY);
mToast.setText(getString(R.string.NorthUp));
}
mToast.show();
mLocationView.invalidate();
return true;
}
});
代码示例来源:origin: cenkgun/ChatBar
@Override
protected void onFinishInflate() {
super.onFinishInflate();
messageEditText = this.findViewById(R.id.messageEditText);
sendButton = this.findViewById(R.id.sendButton);
sendButton.setImageResource(R.drawable.ic_mic);
sendButton.setColorFilter(sendButtonBackgroundColor);
sendButton.getBackground().setColorFilter(sendButtonColor, PorterDuff.Mode.SRC_ATOP);
if (messageBoxHint != null) messageEditText.setHint(messageBoxHint);
messageEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (charSequence.length() != 0) {
sendButton.setImageResource(R.mipmap.input_send);
} else {
sendButton.setImageResource(R.drawable.ic_mic);
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
}
代码示例来源:origin: apps4av/avare
/**
*
*/
private void setCenterButton() {
// Button colors to be synced across activities
if (mPref.isFirstPerson()) {
mCenterButton.getBackground().setColorFilter(0xFF71BC78, PorterDuff.Mode.MULTIPLY);
mToast.setText(getString(R.string.FirstPerson));
mRenderer.getCamera().setFirstPerson(true);
mGlSurfaceView.init();
} else {
mCenterButton.getBackground().setColorFilter(0xFF444444, PorterDuff.Mode.MULTIPLY);
mToast.setText(getString(R.string.BirdEye));
mRenderer.getCamera().setFirstPerson(false);
mGlSurfaceView.init();
}
mToast.show();
}
代码示例来源:origin: apps4av/avare
/**
*
*/
@Override
public void onResume() {
super.onResume();
Helper.setOrientationAndOn(this);
/*
* Registering our receiver
* Bind now.
*/
Intent intent = new Intent(this, StorageService.class);
getApplicationContext().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
if(null != mService) {
// Tell the fuel tank timer we need to know when it runs out
mService.getFuelTimer().addObserver(mTankObserver);
mService.getUpTimer().addObserver(mTimerObserver);
}
// Button colors to be synced across activities
if(mPref.isTrackUpPlates()) {
mCenterButton.getBackground().setColorFilter(0xFF00FF00, PorterDuff.Mode.MULTIPLY);
}
else {
mCenterButton.getBackground().setColorFilter(0xFF444444, PorterDuff.Mode.MULTIPLY);
}
}
代码示例来源:origin: apps4av/avare
@Override
public void onResume() {
super.onResume();
Helper.setOrientationAndOn(this);
/*
* Registering our receiver
* Bind now.
*/
Intent intent = new Intent(this, StorageService.class);
getApplicationContext().bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
// Set visibility of the plan buttons
setPlanButtonVis();
if(null != mService) {
// Tell the fuel tank timer we need to know when it runs out
mService.getFuelTimer().addObserver(mTankObserver);
mService.getUpTimer().addObserver(mTimerObserver);
}
// Button colors to be synced across activities
if(mPref.isTrackUp()) {
mCenterButton.getBackground().setColorFilter(0xFF00FF00, PorterDuff.Mode.MULTIPLY);
}
else {
mCenterButton.getBackground().setColorFilter(0xFF444444, PorterDuff.Mode.MULTIPLY);
}
}
代码示例来源:origin: apps4av/avare
mCenterButton.getBackground().setAlpha(255);
mCenterButton.getBackground().setColorFilter(0xFF444444, PorterDuff.Mode.MULTIPLY);
mCenterButton.setOnClickListener(new OnClickListener() {
@Override
代码示例来源:origin: apps4av/avare
mCenterButton.getBackground().setAlpha(255);
mCenterButton.setOnClickListener(new OnClickListener() {
@Override
代码示例来源:origin: AppLozic/Applozic-Android-SDK
sendButton.setVisibility(alCustomizationSettings.isRecordButton() && (contact != null || channel != null && !Channel.GroupType.OPEN.getValue().equals(channel.getType())) ? View.GONE : View.VISIBLE);
GradientDrawable bgShape = (GradientDrawable) sendButton.getBackground();
bgShape.setColor(Color.parseColor(alCustomizationSettings.getSendButtonBackgroundColor().trim()));
GradientDrawable bgShapeRecordButton = (GradientDrawable) recordButton.getBackground();
bgShapeRecordButton.setColor(Color.parseColor(alCustomizationSettings.getSendButtonBackgroundColor().trim()));
代码示例来源:origin: apps4av/avare
mCenterButton.getBackground().setAlpha(255);
mCenterButton.setOnClickListener(new View.OnClickListener() {
代码示例来源:origin: mkulesh/microMathematics
protected void setButtonSelected(ImageButton b, boolean isSelected)
{
b.setSelected(isSelected);
if (b.isSelected())
{
b.setBackgroundResource(R.drawable.formula_term_border);
CompatUtils.setDrawableColorAttr(getContext(), b.getBackground(), R.attr.colorAccent);
}
else
{
b.setBackgroundResource(android.R.color.transparent);
}
ViewUtils.setImageButtonColorAttr(getContext(), b,
b.isSelected() ? R.attr.colorAccent : R.attr.colorDialogContent);
}
代码示例来源:origin: apps4av/avare
mCenterButton.getBackground().setAlpha(255);
mCenterButton.setOnClickListener(new OnClickListener() {
内容来源于网络,如有侵权,请联系作者删除!