本文整理了Java中android.widget.ImageButton.getDrawable()
方法的一些代码示例,展示了ImageButton.getDrawable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.getDrawable()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:getDrawable
暂无
代码示例来源:origin: pchmn/MaterialChipsInput
public void setDeleteIconColor(ColorStateList color) {
mDeleteButton.getDrawable().mutate().setColorFilter(color.getDefaultColor(), PorterDuff.Mode.SRC_ATOP);
}
代码示例来源:origin: hidroh/materialistic
@Synthetic
void onVoted(Boolean successful) {
if (successful == null) {
Toast.makeText(this, R.string.vote_failed, Toast.LENGTH_SHORT).show();
} else if (successful) {
Drawable drawable = DrawableCompat.wrap(mVoteButton.getDrawable());
DrawableCompat.setTint(drawable, ContextCompat.getColor(this, R.color.greenA700));
Toast.makeText(this, R.string.voted, Toast.LENGTH_SHORT).show();
} else {
AppUtils.showLogin(this, mAlertDialogBuilder);
}
}
代码示例来源:origin: KeepSafe/TapTargetView
final View child = toolbar.getChildAt(i);
if (child instanceof ImageButton) {
final Drawable childDrawable = ((ImageButton) child).getDrawable();
if (childDrawable == navigationIcon) {
return child;
代码示例来源:origin: pchmn/MaterialChipsInput
mDeleteButton.setImageDrawable(mDeleteIcon);
if(mDeleteIconColor != null)
mDeleteButton.getDrawable().mutate().setColorFilter(mDeleteIconColor.getDefaultColor(), PorterDuff.Mode.SRC_ATOP);
代码示例来源:origin: yuliskov/SmartYouTubeTV
private void makeImageEnabled() {
if (mImageButton == null) {
return;
}
Drawable image = mImageButton.getDrawable();
if (image == null) {
return;
}
image.setAlpha(255);
}
代码示例来源:origin: yuliskov/SmartYouTubeTV
private void makeImageDisabled() {
if (mImageButton == null) {
return;
}
Drawable image = mImageButton.getDrawable();
if (image == null) {
return;
}
image.setAlpha(80);
}
代码示例来源:origin: stackoverflow.com
ImageButton imageButton = (ImageButton)findViewById(R.id.aga);
Bitmap one = BitmapFactory.decodeResource(getResources(), R.drawable.pen_circle);
Bitmap oneCopy = Bitmap.createBitmap(one.getWidth(), one.getHeight(), Config.ARGB_8888);
Canvas c = new Canvas(oneCopy);
Paint p = new Paint();
p.setColorFilter(new LightingColorFilter(Color.CYAN, 1));
c.drawBitmap(one, 0, 0, p);
StateListDrawable states = new StateListDrawable();
states.addState(new int[] {android.R.attr.state_pressed}, new BitmapDrawable(oneCopy));
states.addState(new int[] { }, imageButton.getDrawable());
imageButton.setImageDrawable(states);
代码示例来源:origin: heinrichreimer/material-intro
private void updateButtonNextDrawable() {
float realPosition = position + positionOffset;
float offset = 0;
if (buttonNextFunction == BUTTON_NEXT_FUNCTION_NEXT_FINISH) {
if (realPosition >= adapter.getCount() - 1) {
offset = 1;
} else if (realPosition >= adapter.getCount() - 2) {
offset = positionOffset;
}
}
if (offset <= 0) {
miButtonNext.setImageResource(R.drawable.mi_ic_next);
miButtonNext.getDrawable().setAlpha(0xFF);
} else {
miButtonNext.setImageResource(R.drawable.mi_ic_next_finish);
if (miButtonNext.getDrawable() != null && miButtonNext.getDrawable() instanceof LayerDrawable) {
LayerDrawable drawable = (LayerDrawable) miButtonNext.getDrawable();
drawable.getDrawable(0).setAlpha((int) (0xFF * (1 - offset)));
drawable.getDrawable(1).setAlpha((int) (0xFF * offset));
} else {
miButtonNext.setImageResource(offset > 0 ? R.drawable.mi_ic_finish : R.drawable.mi_ic_next);
}
}
}
代码示例来源:origin: heinrichreimer/material-intro
DrawableCompat.setTint(miButtonNext.getDrawable(), iconColor);
DrawableCompat.setTint(miButtonBack.getDrawable(), iconColor);
代码示例来源:origin: stackoverflow.com
ImageButton Logo; // Logo??
Drawabable drawableLogo = Logo.getDrawable();
ImageButton logo;
logo = (ImageButton ) findViewById(R.id.mylogo):
Drawabable drawableLogo = logo.getDrawable();
代码示例来源:origin: stackoverflow.com
//get the image button by id
ImageButton myImg = (ImageButton) findViewById(R.id.some_id);
//get drawable from image button
GradientDrawable drawable = (GradientDrawable) myImg.getDrawable();
//set color as integer
//can use Color.parseColor(color) if color is a string
drawable.setColor(color)
代码示例来源:origin: stackoverflow.com
//get the image button by id
ImageButton myImg = (ImageButton) findViewById(R.id.some_id);
//get drawable from image button
GradientDrawable drawable = (GradientDrawable) myImg.getDrawable();
//set color as integer
//can use Color.parseColor(color) if color is a string
drawable.setColor(color)
代码示例来源:origin: stackoverflow.com
ImageButton btn = (ImageButton) findViewById(R.id.myImageBtn);
Drawable drawable = btn.getDrawable();
if (drawable.getConstantState().equals(getResources().getDrawable(R.drawable.myDrawable).getConstantState())){
//Do your work here
}
代码示例来源:origin: julesbond007/android-jigsaw-puzzle
/**
* Set the brushes to the color chosen
*
* @param color the chosen color
*/
private void setBrushColor(int color) {
for (View v : getBrushes()) {
ImageButton im = (ImageButton) v;
GradientDrawable d = (GradientDrawable) im.getDrawable();
d.setColor(color);
}
}
代码示例来源:origin: philliphsu/NumberPadTimePicker
@Override
public NumberPadTimePickerThemer setBackspaceTint(ColorStateList colors) {
DrawableCompat.setTintList(mBackspace.getDrawable(), colors);
return this;
}
代码示例来源:origin: stackoverflow.com
public static void tintButton(@NonNull ImageButton button) {
ColorStateList colours = button.getResources()
.getColorStateList(R.color.button_colour);
Drawable d = DrawableCompat.wrap(button.getDrawable());
DrawableCompat.setTintList(d, colours);
button.setImageDrawable(d);
}
代码示例来源:origin: com.willowtreeapps/oak-demos
private void updateTextButtonVisibility() {
boolean visible = !TextUtils.isEmpty(mTextButton.getText());
visible &= mImageButton.getDrawable() == null ||
(mItemData.showsTextAsAction() && (mAllowTextWithIcon || mExpandedFormat));
mTextButton.setVisibility(visible ? VISIBLE : GONE);
}
代码示例来源:origin: com.actionbarsherlock/actionbarsherlock
private void updateTextButtonVisibility() {
boolean visible = !TextUtils.isEmpty(mTextButton.getText());
visible &= mImageButton.getDrawable() == null ||
(mItemData.showsTextAsAction() && (mAllowTextWithIcon || mExpandedFormat));
mTextButton.setVisibility(visible ? VISIBLE : GONE);
}
代码示例来源:origin: geniusgithub/AndroidDialer
public void changeIcon(Drawable icon, String description) {
if (mFloatingActionButton.getDrawable() != icon
|| !mFloatingActionButton.getContentDescription().equals(description)) {
mFloatingActionButton.setImageDrawable(icon);
mFloatingActionButton.setContentDescription(description);
}
}
代码示例来源:origin: stackoverflow.com
ImageButton img = (ImageButton)findViewById(R.id.imageView);
AnimationDrawable frameAnimation = (AnimationDrawable)img.getDrawable();
frameAnimation.setCallback(img);
frameAnimation.setVisible(true, true);
frameAnimation.start();
内容来源于网络,如有侵权,请联系作者删除!