本文整理了Java中android.widget.ImageButton.setColorFilter()
方法的一些代码示例,展示了ImageButton.setColorFilter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.setColorFilter()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:setColorFilter
暂无
代码示例来源:origin: wdullaer/MaterialDateTimePicker
private void init() {
dayPickerView = new SimpleDayPickerView(getContext(), controller);
addView(dayPickerView);
final LayoutInflater inflater = LayoutInflater.from(getContext());
final ViewGroup content = (ViewGroup) inflater.inflate(R.layout.mdtp_daypicker_group, this, false);
// Transfer all children from the content to this
while (content.getChildCount() > 0) {
final View view = content.getChildAt(0);
content.removeViewAt(0);
addView(view);
}
prevButton = findViewById(R.id.mdtp_previous_month_arrow);
nextButton = findViewById(R.id.mdtp_next_month_arrow);
if (controller.getVersion() == DatePickerDialog.Version.VERSION_1) {
int size = Utils.dpToPx(16f, getResources());
prevButton.setMinimumHeight(size);
prevButton.setMinimumWidth(size);
nextButton.setMinimumHeight(size);
nextButton.setMinimumWidth(size);
}
if (controller.isThemeDark()) {
int color = ContextCompat.getColor(getContext(), R.color.mdtp_date_picker_text_normal_dark_theme);
prevButton.setColorFilter(color);
nextButton.setColorFilter(color);
}
prevButton.setOnClickListener(this);
nextButton.setOnClickListener(this);
dayPickerView.setOnPageListener(this);
}
代码示例来源:origin: Neamar/KISS
phoneButton.setColorFilter(primaryColor);
messageButton.setColorFilter(primaryColor);
代码示例来源:origin: laizimo/richeditor
@Override
public void settingAfterCreate(boolean isSelected, final ImageButton imageView) {
if (enableAutoSet) {
if (isSelected) {
imageView.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN);
} else {
imageView.setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN);
}
}else {
imageView.setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN);
}
}
代码示例来源:origin: jorgegil96/All-NBA
private void setUpvoteIcon(boolean active) {
if (active) {
btnUpvote.setColorFilter(ContextCompat.getColor(itemView.getContext(), R.color
.commentUpvoted));
} else {
btnUpvote.setColorFilter(textColor);
}
}
代码示例来源:origin: bitcraze/crazyflie-android-client
@Override
public void run() {
mHeadlightButton.setColorFilter(toggle ? Color.parseColor("#00FF00") : Color.BLACK);
}
});
代码示例来源:origin: jorgegil96/All-NBA
private void setDownvoteIcon(boolean active) {
if (active) {
btnDownvote.setColorFilter(ContextCompat.getColor(itemView.getContext(), R.color
.commentDownvoted));
} else {
btnDownvote.setColorFilter(textColor);
}
}
代码示例来源:origin: jorgegil96/All-NBA
private void setUpvoteIcon(boolean active) {
if (active) {
btnUpvote.setColorFilter(ContextCompat.getColor(itemView.getContext(), R.color
.commentUpvoted));
} else {
btnUpvote.setColorFilter(textColor);
}
}
代码示例来源:origin: jorgegil96/All-NBA
private void setDownvoteIcon(boolean active) {
if (active) {
btnDownvote.setColorFilter(ContextCompat.getColor(itemView.getContext(), R.color
.commentDownvoted));
} else {
btnDownvote.setColorFilter(textColor);
}
}
}
代码示例来源:origin: jorgegil96/All-NBA
private void setUpvoteIcon(boolean active) {
if (active) {
btnUpvote.setColorFilter(ContextCompat.getColor(itemView.getContext(), R.color
.commentUpvoted));
} else {
btnUpvote.setColorFilter(textColor);
}
}
代码示例来源:origin: jorgegil96/All-NBA
private void setDownvoteIcon(boolean active) {
if (active) {
btnDownvote.setColorFilter(ContextCompat.getColor(itemView.getContext(), R.color
.commentDownvoted));
} else {
btnDownvote.setColorFilter(textColor);
}
}
代码示例来源:origin: jorgegil96/All-NBA
private void setSavedIcon() {
btnSave.setImageResource(R.drawable.ic_bookmark_black_18dp);
btnSave.setColorFilter(textColor);
}
代码示例来源:origin: jorgegil96/All-NBA
private void setUnsavedIcon() {
btnSave.setImageResource(R.drawable.ic_bookmark_border_black_18dp);
btnSave.setColorFilter(textColor);
}
代码示例来源:origin: saki4510t/AudioVideoRecordingSample
/**
* request stop recording
*/
private void stopRecording() {
if (DEBUG) Log.v(TAG, "stopRecording:mMuxer=" + mMuxer);
mRecordButton.setColorFilter(0); // return to default color
if (mMuxer != null) {
mMuxer.stopRecording();
mMuxer = null;
// you should not wait here
}
}
代码示例来源:origin: mingjunli/GithubApp
/**
* Override next button arrow color
*
* @param color your color
*/
public void setNextArrowColor(@ColorInt final int color) {
ImageButton nextButton = (ImageButton) findViewById(R.id.next);
nextButton.setColorFilter(color);
}
代码示例来源:origin: geniusgithub/AndroidDialer
/**
* Whenever a voicemail archive succeeds or fails, clear the text displayed in the voicemail
* card.
*/
private void onVoicemailArchiveResult() {
enableUiElements();
mStateText.setText(null);
mArchiveButton.setColorFilter(null);
}
代码示例来源:origin: dsolonenko/financisto
static void updateFilterColor(Context context, WhereFilter filter, ImageButton button) {
int color = filter.isEmpty() ? context.getResources().getColor(R.color.bottom_bar_tint) : context.getResources().getColor(R.color.holo_blue_dark);
button.setColorFilter(color);
}
代码示例来源:origin: abrenoch/hyperion-android-grabber
@Override
public void onFocusChange(View view, boolean focused) {
int clr = Color.argb(255, 0, 0, 150);
if (!focused) {
clr = Color.argb(255, 0, 0, 0);
}
switch (view.getId()) {
case R.id.power_toggle:
((ImageView) view).setColorFilter(clr);
break;
case R.id.settingsButton:
((ImageButton) view).setColorFilter(clr);
break;
}
}
代码示例来源:origin: apptentive/apptentive-android
public void setButtonState(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
if (enabled) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
button.setColorFilter(Util.getThemeColor(itemView.getContext(), R.attr.apptentiveButtonTintColor));
}
} else {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
button.setColorFilter(Util.getThemeColor(itemView.getContext(), R.attr.apptentiveButtonTintColorDisabled));
}
}
}
}
代码示例来源:origin: googlecreativelab/ar-drawing-java
/**
* onClickSettings toggles showing and hiding the Line Width, Smoothing, and Debug View toggle
*/
public void onClickSettings(View button) {
ImageButton settingsButton = findViewById(R.id.settingsButton);
if (mSettingsUI.getVisibility() == View.GONE) {
mSettingsUI.setVisibility(View.VISIBLE);
mLineDistanceScaleBar = findViewById(R.id.distanceScale);
mLineWidthBar = findViewById(R.id.lineWidth);
settingsButton.setColorFilter(getResources().getColor(R.color.active));
} else {
mSettingsUI.setVisibility(View.GONE);
settingsButton.setColorFilter(getResources().getColor(R.color.gray));
}
}
代码示例来源:origin: mkulesh/microMathematics
/**
* Procedure sets ImageButton color given by attribute ID
*/
public static void setImageButtonColorAttr(Context context, ImageButton b, @AttrRes int resId)
{
final int c = CompatUtils.getThemeColorAttr(context, resId);
b.clearColorFilter();
b.setColorFilter(c, PorterDuff.Mode.SRC_ATOP);
}
内容来源于网络,如有侵权,请联系作者删除!