android.widget.ImageView.setContentDescription()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(356)

本文整理了Java中android.widget.ImageView.setContentDescription()方法的一些代码示例,展示了ImageView.setContentDescription()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setContentDescription()方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setContentDescription

ImageView.setContentDescription介绍

暂无

代码示例

代码示例来源:origin: prolificinteractive/material-calendarview

/**
 * Set content description for button future
 *
 * @param description String to use as content description
 */
public void setContentDescriptionArrowFuture(final CharSequence description) {
 buttonFuture.setContentDescription(description);
}

代码示例来源:origin: prolificinteractive/material-calendarview

/**
 * Set content description for button past
 *
 * @param description String to use as content description
 */
public void setContentDescriptionArrowPast(final CharSequence description) {
 buttonPast.setContentDescription(description);
}

代码示例来源:origin: google/ExoPlayer

case Player.REPEAT_MODE_OFF:
 repeatToggleButton.setImageDrawable(repeatOffButtonDrawable);
 repeatToggleButton.setContentDescription(repeatOffButtonContentDescription);
 break;
case Player.REPEAT_MODE_ONE:
 repeatToggleButton.setImageDrawable(repeatOneButtonDrawable);
 repeatToggleButton.setContentDescription(repeatOneButtonContentDescription);
 break;
case Player.REPEAT_MODE_ALL:
 repeatToggleButton.setImageDrawable(repeatAllButtonDrawable);
 repeatToggleButton.setContentDescription(repeatAllButtonContentDescription);
 break;
default:

代码示例来源:origin: arimorty/floatingsearchview

action.setContentDescription(menuItem.getTitle());
action.setImageDrawable(menuItem.getIcon());
Util.setIconColor(action, mActionIconColor);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: udacity/ud851-Sunshine

mDetailBinding.primaryInfo.weatherIcon.setContentDescription(descriptionA11y);

代码示例来源:origin: julian-klode/dns66

@Override
  public void onClick(View v) {
    if (extra.getVisibility() == View.GONE) {
      if (preferences.getBoolean("extraBarClosed:" + name, false)) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("extraBarClosed:" + name, false);
        editor.apply();
      }
      view.announceForAccessibility(view.getContext().getString(R.string.expand_bar_expanded));
      expand.setImageDrawable(view.getContext().getDrawable(R.drawable.ic_expand_less_black_24dp));
      expand.setContentDescription(view.getContext().getString(R.string.expand_bar_toggle_close));
      extra.setVisibility(View.VISIBLE);
    } else {
      if (!preferences.getBoolean("extraBarClosed:" + name, false)) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("extraBarClosed:" + name, true);
        editor.apply();
      }
      view.announceForAccessibility(view.getContext().getString(R.string.expand_bar_closed));
      expand.setImageDrawable(view.getContext().getDrawable(R.drawable.ic_expand_more_black_24dp));
      expand.setContentDescription(view.getContext().getString(R.string.expand_bar_toggle_expand));
      extra.setVisibility(View.GONE);
    }
  }
};

代码示例来源:origin: julian-klode/dns66

void updateState() {
  iconView.setImageAlpha(255 * 87 / 100);
  if (stateChoices == 2) {
    switch (item.state) {
      case Configuration.Item.STATE_IGNORE:
      case Configuration.Item.STATE_DENY:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_check_box_outline_blank_black_24dp));
        iconView.setContentDescription(context.getString(R.string.do_not_use_dns_server));
        break;
      case Configuration.Item.STATE_ALLOW:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_check_box_black_24dp));
        iconView.setContentDescription(context.getString(R.string.use_dns_server));
        break;
    }
  } else {
    switch (item.state) {
      case Configuration.Item.STATE_IGNORE:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_state_ignore));
        iconView.setImageAlpha(255 * 38 / 100);
        break;
      case Configuration.Item.STATE_DENY:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_state_deny));
        break;
      case Configuration.Item.STATE_ALLOW:
        iconView.setImageDrawable(context.getDrawable(R.drawable.ic_state_allow));
        break;
    }
    iconView.setContentDescription(context.getResources().getStringArray(R.array.item_states)[item.state]);
  }
}

代码示例来源:origin: julian-klode/dns66

stateImage.setContentDescription(rootView.getContext().getString(AdVpnService.vpnStatusToTextId(status)));
stateImage.setImageAlpha(255);
stateImage.setImageTintList(ContextCompat.getColorStateList(context, R.color.colorStateImage));

代码示例来源:origin: Neamar/KISS

image.setContentDescription(pojo.getName());

代码示例来源:origin: stackoverflow.com

public String randomFactClicked(View view) 
{
 String message = randomFactGenerator();

 ImageView imageView = (ImageView) view;
 imageView.setContentDescription(message);

 return message;
}

代码示例来源:origin: MoMoWait/LeanbackLauncher

public void init(CharSequence title, Drawable banner, int launchColor) {
  super.init(null, null, null, launchColor);
  if (this.mBannerView != null) {
    this.mBannerView.setImageDrawable(banner);
    this.mBannerView.setContentDescription(title);
  }
}

代码示例来源:origin: googlesamples/android-AutofillFramework

private void setupSettingsButton(int containerId, int labelId, int imageViewId,
    final View.OnClickListener onClickListener) {
  ViewGroup container = findViewById(containerId);
  TextView buttonLabel = container.findViewById(labelId);
  String buttonLabelText = buttonLabel.getText().toString();
  ImageView imageView = container.findViewById(imageViewId);
  imageView.setContentDescription(buttonLabelText);
  container.setOnClickListener(onClickListener);
}

代码示例来源:origin: WuXiaolong/WoChat

@Override
  public void done(List<LeanchatUser> list, AVException e) {
    if (e == null) {
      avatarView.setContentDescription(list.get(0).getAvatarUrl());
      Picasso.with(mContext).load(list.get(0).getAvatarUrl()).placeholder(R.mipmap.chat_default_user_avatar)
          .error(R.mipmap.chat_default_user_avatar).into(avatarView);
      nameView.setText(list.get(0).getNickname());
    }
  }
});

相关文章

ImageView类方法