下面列出了android.widget.ImageButton# setColorFilter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public ViewHolder(final View convertView) {
super(convertView);
name = (TextView) convertView.findViewById(R.id.name);
size = (TextView) convertView.findViewById(R.id.items);
attr = (TextView) convertView.findViewById(R.id.attr);
lastModified = (TextView) convertView.findViewById(R.id.lastModified);
type = (TextView) convertView.findViewById(R.id.type);
cbx = (ImageButton) convertView.findViewById(R.id.cbx);
image = (ImageView)convertView.findViewById(R.id.icon);
more = (ImageButton)convertView.findViewById(R.id.more);
more.setColorFilter(Constants.TEXT_COLOR);
name.setTextColor(Constants.DIR_COLOR);
size.setTextColor(Constants.TEXT_COLOR);
//attr.setTextColor(Constants.TEXT_COLOR);
lastModified.setTextColor(Constants.TEXT_COLOR);
if (type != null) {
type.setTextColor(Constants.TEXT_COLOR);
}
image.setScaleType(ImageView.ScaleType.FIT_CENTER);
convertView.setTag(this);
this.convertedView = convertView;
}
/**
* Ensure that the chrome, control, and text colors displayed on the screen are correct.
*/
public void updateColors() {
currentTime.setTextColor(textColor);
endTime.setTextColor(textColor);
videoTitleView.setTextColor(textColor);
fullscreenButton.setColorFilter(controlColor);
pausePlayButton.setColorFilter(controlColor);
seekBar.getProgressDrawable().setColorFilter(seekbarColor, PorterDuff.Mode.SRC_ATOP);
seekBar.getThumb().setColorFilter(seekbarColor, PorterDuff.Mode.SRC_ATOP);
// Hide the thumb drawable if the SeekBar is disabled
if (canSeek) {
seekBar.getThumb().mutate().setAlpha(255);
} else {
seekBar.getThumb().mutate().setAlpha(0);
}
for (ImageButton imageButton : actionButtons) {
imageButton.setColorFilter(controlColor);
}
topChrome.setBackgroundColor(chromeColor);
bottomChrome.setBackgroundColor(chromeColor);
}
private void addIconTabWithCounter(final int position, int resId)
{
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
tab.setColorFilter(position == pager.getCurrentItem() ? tabTextIconSelectedColor : tabTextIconUnselectedColor, PorterDuff.Mode.SRC_IN);
tab.setScaleType(ImageView.ScaleType.CENTER);
addTabWithCounter(position, tab);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.dlg_suitable_maps_list, container, false);
listView = (ListView) view.findViewById(android.R.id.list);
View infoButton = view.findViewById(R.id.information_button);
infoButton.setOnClickListener(onMapInformation);
ImageButton editButton = (ImageButton) view.findViewById(R.id.edit_button);
editButton.setColorFilter(disable);
editButton.setOnClickListener(onMapEdit);
openButton = view.findViewById(R.id.open_button);
openButton.setOnClickListener(onMapOpen);
return view;
}
ViewHolder(final View view) {
super(view);
txtTitle = (TextView) view.findViewById(R.id.text1);
image = (ImageButton) view.findViewById(R.id.delete_button);
txtDesc = (TextView) view.findViewById(R.id.text2);
row = (LinearLayout) view.findViewById(R.id.bookmarkrow);
image.setColorFilter(Constants.TEXT_COLOR);
txtDesc.setTextColor(Constants.TEXT_COLOR);
}
private ViewHolder(View convertView) {
super(convertView);
name = (TextView) convertView.findViewById(R.id.name);
items = (TextView) convertView.findViewById(R.id.items);
attr = (TextView) convertView.findViewById(R.id.attr);
lastModified = (TextView) convertView.findViewById(R.id.lastModified);
type = (TextView) convertView.findViewById(R.id.type);
cbx = (ImageButton) convertView.findViewById(R.id.cbx);
image = (ImageView) convertView.findViewById(R.id.icon);
more = (ImageButton) convertView.findViewById(R.id.more);
ll = convertView;
ll.setTag(this);
ll.setOnClickListener(AppsAdapter.this);
cbx.setOnClickListener(AppsAdapter.this);
ll.setOnLongClickListener(AppsAdapter.this);
cbx.setOnLongClickListener(AppsAdapter.this);
more.setOnClickListener(AppsAdapter.this);
more.setColorFilter(Constants.TEXT_COLOR);
name.setTextColor(Constants.DIR_COLOR);
items.setTextColor(Constants.TEXT_COLOR);
attr.setTextColor(Constants.TEXT_COLOR);
lastModified.setTextColor(Constants.TEXT_COLOR);
type.setTextColor(Constants.TEXT_COLOR);
}
private void disableButton(ImageButton button) {
if (nightMode()) {
button.setColorFilter(Color.rgb(112, 112, 112));
} else {
button.setColorFilter(Color.rgb(224, 224, 224));
}
button.setClickable(false);
}
private void addIconTabWithCounter(final int position, int resId)
{
ImageButton tab = new ImageButton(getContext());
tab.setImageResource(resId);
tab.setColorFilter(position == pager.getCurrentItem() ? tabTextIconSelectedColor : tabTextIconUnselectedColor, PorterDuff.Mode.SRC_IN);
tab.setScaleType(ImageView.ScaleType.CENTER);
addTabWithCounter(position, tab);
}
/**
* 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));
}
}
private ImageButton inflateButton(final Context context, @DrawableRes final int icon, @StringRes final int categoryName, final ViewGroup parent) {
final ImageButton button = (ImageButton) LayoutInflater.from(context).inflate(R.layout.emoji_view_category, parent, false);
button.setImageDrawable(AppCompatResources.getDrawable(context, icon));
button.setColorFilter(themeIconColor, PorterDuff.Mode.SRC_IN);
button.setContentDescription(context.getString(categoryName));
parent.addView(button);
return button;
}
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255):Color.argb(255, 128, 128, 128));
}
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
private void setActionOff(ImageButton view){
view.setBackgroundResource(0);
view.setColorFilter(App.CONTEXT.getResources().getColor(R.color.md_blue_grey_300));
}
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
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);
}
private void setButtonEnabled(ImageButton button, boolean enabled) {
button.setEnabled(enabled);
button.setColorFilter(enabled ? Color.argb(255, 255, 255, 255) : Color.argb(255, 128, 128, 128));
}
private void setActionOn(ImageButton view){
view.setBackgroundResource(R.drawable.background_rich_edit_action_on);
view.setColorFilter(App.CONTEXT.getResources().getColor(R.color.md_blue_grey_500));
}
/**
* 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);
}