本文整理汇总了Java中android.widget.ImageView.setContentDescription方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setContentDescription方法的具体用法?Java ImageView.setContentDescription怎么用?Java ImageView.setContentDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setContentDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeSystemShortcut
import android.widget.ImageView; //导入方法依赖的package包/类
public static void initializeSystemShortcut(Context context, View view, SystemShortcut info) {
if (view instanceof DeepShortcutView) {
// Expanded system shortcut, with both icon and text shown on white background.
final DeepShortcutView shortcutView = (DeepShortcutView) view;
shortcutView.getIconView().setBackground(info.getIcon(context,
android.R.attr.textColorTertiary));
shortcutView.getBubbleText().setText(info.getLabel(context));
} else if (view instanceof ImageView) {
// Only the system shortcut icon shows on a gray background header.
final ImageView shortcutIcon = (ImageView) view;
shortcutIcon.setImageDrawable(info.getIcon(context,
android.R.attr.textColorHint));
shortcutIcon.setContentDescription(info.getLabel(context));
}
view.setTag(info);
}
示例2: done
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Done mutating entity header, rebinds everything (optionally skip rebinding buttons).
*/
public View done(AppCompatActivity activity, boolean rebindActions) {
styleActionBar(activity);
ImageView iconView = mHeader.findViewById(R.id.entity_header_icon);
if (iconView != null) {
iconView.setImageDrawable(mIcon);
iconView.setContentDescription(mIconContentDescription);
}
setText(R.id.entity_header_title, mLabel);
setText(R.id.entity_header_summary, mSummary);
if (rebindActions) {
bindHeaderButtons();
}
return mHeader;
}
示例3: setUpBackdrop
import android.widget.ImageView; //导入方法依赖的package包/类
private void setUpBackdrop(View view) {
Context context = view.getContext();
ImageView imgBackdrop = (ImageView) view.findViewById(R.id.iv_movie_backdrop);
View viewOverlay = view.findViewById(R.id.view_backdrop_overlay);
TextView tvTitle = (TextView) view.findViewById(R.id.tv_movie_detail_title);
Picasso.with(context)
.load(R.mipmap.civil_war_backdrop)
.transform(new GrayscaleTransformation(Picasso.with(context)))
.into(imgBackdrop);
imgBackdrop.setContentDescription(mTitle);
viewOverlay.setAlpha((float) 0.8);
}
示例4: setUpSpeakerSocialIcon
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Determines visibility of a social icon, sets up a click listener to allow the user to
* navigate to the social network associated with the icon, and sets up a content description
* for the icon.
*/
private void setUpSpeakerSocialIcon(final SessionDetailModel.Speaker speaker,
ImageView socialIcon, final String socialUrl,
String socialNetworkName, final String packageName) {
if (socialUrl == null || socialUrl.isEmpty()) {
socialIcon.setVisibility(View.GONE);
} else {
socialIcon.setContentDescription(getString(
R.string.speaker_social_page,
socialNetworkName,
speaker.getName())
);
socialIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
UIUtils.fireSocialIntent(
getActivity(),
Uri.parse(socialUrl),
packageName
);
}
});
}
}
示例5: FrameLayout
import android.widget.ImageView; //导入方法依赖的package包/类
private void addIconTabBådeTekstOgBillede(final int position, int resId, String url, String title) {
FrameLayout tabfl = new FrameLayout(getContext());
ImageView tabi = new ImageView(getContext());
tabi.setContentDescription(title);
//Log.d(title+" "+resId + " Kanallogo URL="+url);
if (resId==0) {
Picasso.with(tabi.getContext())
.load(url).placeholder(null)
.into(tabi);
tabi.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
tabi.setAdjustViewBounds(true);
tabi.setVisibility(View.GONE);
} else {
tabi.setImageResource(resId);
tabi.setVisibility(View.INVISIBLE);
}
TextView tabt = new TextView(getContext());
tabt.setText(title);
tabt.setTypeface(App.skrift_gibson);
tabt.setGravity(Gravity.CENTER);
tabt.setSingleLine();
tabfl.addView(tabi);
tabfl.addView(tabt);
LayoutParams lp = (LayoutParams) tabi.getLayoutParams();
lp.gravity=Gravity.CENTER;
lp.width=lp.height=ViewGroup.LayoutParams.MATCH_PARENT;
lp = (LayoutParams) tabt.getLayoutParams();
lp.width=lp.height=ViewGroup.LayoutParams.MATCH_PARENT;
lp.gravity=Gravity.CENTER;
addTab(position, tabfl);
}
示例6: onProgressUpdate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onProgressUpdate(DonateActivity.DonateItem... values) {
if (mReference.get() != null) {
DonateActivity.DonateItem item = values[0];
ImageView donate = item.imageView;
donate.setContentDescription(item.label);
donate.setImageDrawable(item.icon);
donate.setClickable(true);
donate.setVisibility(View.VISIBLE);
}
}
示例7: toggleLED
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Sets a clicked cell on/off.
*
* @param image An image of a clicked cell.
* @param pos Position of a clicked cell.
* @return True, if cell is on and false otherwise.
*/
private boolean toggleLED(ImageView image, int pos) {
boolean isOn;
//Toast.makeText(this, "Pos :" + pos, Toast.LENGTH_SHORT).show();
int state = (Integer) image.getTag(R.id.ledState);
if(state != 1) {
DEVICE_CODE_ARRAY[pos] = 1;
image.setBackground(getApplication().getResources().getDrawable(R.drawable.red_white_led_btn));
image.setTag(R.id.ledState, 1);
isOn = true;
} else {
DEVICE_CODE_ARRAY[pos] = 0;
image.setBackground(getApplication().getResources().getDrawable(R.drawable.white_red_led_btn));
image.setTag(R.id.ledState, 0);
isOn = false;
// Update the code to consider the still ON LED below the toggled one
if(pos < 20) {
DEVICE_CODE_ARRAY[pos + 5] = 1;
}
}
image.setSelected(false);
int position = (Integer) image.getTag(R.id.position);
image.setContentDescription("" + position + getLEDStatus(pos));
return isOn;
}
示例8: addTab
import android.widget.ImageView; //导入方法依赖的package包/类
private void addTab(final TabHost host, final int categoryId) {
final String tabId = EmojiCategory.getCategoryName(categoryId, 0 /* categoryPageId */);
final TabHost.TabSpec tspec = host.newTabSpec(tabId);
tspec.setContent(R.id.emoji_keyboard_dummy);
final ImageView iconView = (ImageView)LayoutInflater.from(getContext()).inflate(
R.layout.emoji_keyboard_tab_icon, null);
// TODO: Replace background color with its own setting rather than using the
// category page indicator background as a workaround.
iconView.setBackgroundColor(mCategoryPageIndicatorBackground);
iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
tspec.setIndicator(iconView);
host.addTab(tspec);
}
示例9: setupSettingsButton
import android.widget.ImageView; //导入方法依赖的package包/类
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);
}
示例10: initSubViews
import android.widget.ImageView; //导入方法依赖的package包/类
private void initSubViews() {
Context context = getContext();
mDragSelect=new ImageView(context);
mDragSelect.setImageResource(R.drawable.ic_drag_select_36dp_n);
mDragSelect.setOnClickListener(this);
mDragSelect.setContentDescription(getContext().getString(R.string.app_name));
mDrag=new ImageView(context);
mDrag.setImageResource(R.drawable.ic_sort_white_36dp);
mDrag.setOnClickListener(this);
mDrag.setContentDescription(getContext().getString(R.string.app_name));
mType=new ImageView(context);
mType.setImageResource(R.drawable.bigbang_action_cloud);
mType.setOnClickListener(this);
mType.setContentDescription(getContext().getString(R.string.app_name));
mSelectOther=new ImageView(context);
mSelectOther.setImageResource(R.drawable.bigbang_action_select_other);
mSelectOther.setOnClickListener(this);
mSelectOther.setContentDescription(getContext().getString(R.string.app_name));
mSymbol=new ImageView(context);
mSymbol.setImageResource(R.drawable.bigbang_action_symbol);
mSymbol.setOnClickListener(this);
mSymbol.setContentDescription(getContext().getString(R.string.app_name));
mSection=new ImageView(context);
mSection.setImageResource(R.drawable.bigbang_action_enter);
mSection.setOnClickListener(this);
mSection.setContentDescription(getContext().getString(R.string.app_name));
addView(mDragSelect, createLayoutParams());
addView(mDrag, createLayoutParams());
addView(mType, createLayoutParams());
addView(mSelectOther, createLayoutParams());
addView(mSection, createLayoutParams());
addView(mSymbol, createLayoutParams());
setWillNotDraw(false);
mActionGap = (int) ViewUtil.dp2px(5);
mContentPadding = (int) ViewUtil.dp2px(10);
}
示例11: initSubViews
import android.widget.ImageView; //导入方法依赖的package包/类
private void initSubViews() {
Context context = getContext();
mBorder = ContextCompat.getDrawable(context, R.drawable.bigbang_action_bar_bg);
mBorder.setCallback(this);
mSearch = new ImageView(context);
mSearch.setImageResource(R.drawable.bigbang_action_search);
mSearch.setOnClickListener(this);
mSearch.setContentDescription(getContext().getString(R.string.app_name));
mShare = new ImageView(context);
mShare.setImageResource(R.drawable.bigbang_action_share);
mShare.setOnClickListener(this);
mShare.setContentDescription(getContext().getString(R.string.app_name));
mCopy = new ImageView(context);
mCopy.setImageResource(R.drawable.bigbang_action_copy);
mCopy.setOnClickListener(this);
mCopy.setContentDescription(getContext().getString(R.string.app_name));
// mDrag=new ImageView(context);
// mDrag.setImageResource(R.drawable.ic_sort_white_36dp);
// mDrag.setOnClickListener(this);
mTrans = new ImageView(context);
mTrans.setImageResource(R.drawable.ic_compare_arrows_white_36dp);
mTrans.setOnClickListener(this);
mTrans.setContentDescription(getContext().getString(R.string.app_name));
// mSelectAll=new ImageView(context);
// mSelectAll.setImageResource(R.drawable.bigbang_action_select_all);
// mSelectAll.setOnClickListener(this);
//
// mSelectOther=new ImageView(context);
// mSelectOther.setImageResource(R.drawable.bigbang_action_select_other);
// mSelectOther.setOnClickListener(this);
mClose = new ImageView(context);
mClose.setImageResource(R.drawable.ic_close_capture);
mClose.setOnClickListener(this);
mClose.setContentDescription(getContext().getString(R.string.app_name));
addView(mSearch, createLayoutParams());
addView(mShare, createLayoutParams());
addView(mCopy, createLayoutParams());
addView(mTrans, createLayoutParams());
addView(mClose, createLayoutParams());
// addView(mDrag, createLayoutParams());
// addView(mSelectAll, createLayoutParams());
// addView(mSelectOther, createLayoutParams());
// mSearch.setVisibility(VISIBLE);
// mShare.setVisibility(VISIBLE);
// mTrans.setVisibility(VISIBLE);
// mSelectAll.setVisibility(GONE);
// mSelectOther.setVisibility(GONE);
setWillNotDraw(false);
mActionGap = (int) ViewUtil.dp2px(5);
mContentPadding = (int) ViewUtil.dp2px(10);
}
示例12: cretaeSuccessView
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected View cretaeSuccessView() {
View view = UIUtils.inflate(R.layout.fragment_app_introduction);
ButterKnife.bind(this, view);
/*应用截图数据*/
for (int i = 0; i < mIntroductionBean.getImageCompressList().size(); i++) {
String url = mIntroductionBean.getImageCompressList().get(i);
View screenView = View.inflate(getContext(), R.layout.appdetail_item_screen_image, null);
ImageView screenImageView = (ImageView) screenView.findViewById(R.id.appdetail_screen_img_imageview);
//设置图片描述(一般用户是看不到的)
screenImageView.setContentDescription(screenImageView.getResources().getString(R.string.appdetail_screenshot));
//设置图片的放大模式
screenImageView.setScaleType(ImageView.ScaleType.FIT_XY);
screenView.setOnClickListener(this);
screenView.setTag(i);
Glide.with(UIUtils.getContext()).load(url).into(screenImageView);
app_detail_gallery_container.addView(screenView);
}
/*应用信息描述*/
appInfoTariff.setText(mIntroductionBean.getAppInfoBean().getTariffDesc());
appInfoSize.setText(Formatter.formatFileSize(getContext(), Long.parseLong(mIntroductionBean.getAppInfoBean().getSize())));
appInfoDate.setText(mIntroductionBean.getAppInfoBean().getReleaseDate());
appInfoVersion.setText(mIntroductionBean.getAppInfoBean().getVersion());
appInfoDeveloper.setText(mIntroductionBean.getAppInfoBean().getDeveloper());
for (int i = 0; i < mIntroductionBean.getAppDetailInfoBeanList().size(); i++) {
FoldingTextView foldingTextView = new FoldingTextView(getContext());
foldingTextView.setTitle(mIntroductionBean.getAppDetailInfoBeanList().get(i).getTitle());
foldingTextView.setContent(mIntroductionBean.getAppDetailInfoBeanList().get(i).getBody());
appInfoDes.addView(foldingTextView);
}
//应用标签数据
List<String> tagList = mIntroductionBean.getTagList();
for (int i = 0; i < tagList.size(); i++) {
View labView = UIUtils.inflate(R.layout.appdetail_item_label_item);
TextView tv = (TextView) labView.findViewById(R.id.appdetail_label_content_textview);
tv.setText(tagList.get(i));
flowLayout.addView(labView);
}
return view;
}
示例13: onBindViewHolder
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(TranslationViewHolder holder, int position) {
TranslationRowData rowItem = translations.get(position);
switch (holder.getItemViewType()) {
case R.layout.translation_row:
TranslationItem item = (TranslationItem) rowItem;
holder.getTranslationTitle().setText(item.name());
if (TextUtils.isEmpty(item.translation.translatorNameLocalized)) {
holder.getTranslationInfo().setText(item.translation.translator);
} else {
holder.getTranslationInfo().setText(item.translation.translatorNameLocalized);
}
ImageView leftImage = holder.getLeftImage();
ImageView rightImage = holder.getRightImage();
if (item.exists()) {
if (item.needsUpgrade()) {
leftImage.setImageResource(R.drawable.ic_download);
leftImage.setVisibility(View.VISIBLE);
holder.getTranslationInfo().setText(R.string.update_available);
} else {
leftImage.setVisibility(View.GONE);
}
rightImage.setImageResource(R.drawable.ic_cancel);
rightImage.setVisibility(View.VISIBLE);
rightImage.setContentDescription(context.getString(R.string.remove_button));
} else {
leftImage.setVisibility(View.GONE);
rightImage.setImageResource(R.drawable.ic_download);
rightImage.setVisibility(View.VISIBLE);
rightImage.setOnClickListener(null);
rightImage.setClickable(false);
rightImage.setContentDescription(null);
}
break;
case R.layout.translation_sep:
holder.getSeparatorText().setText(rowItem.name());
break;
}
}
示例14: initSubViews
import android.widget.ImageView; //导入方法依赖的package包/类
private void initSubViews() {
Context context = getContext();
mDragSelect=new ImageView(context);
mDragSelect.setImageResource(R.mipmap.ic_drag_select_36dp_n);
mDragSelect.setOnClickListener(this);
mDragSelect.setContentDescription(getContext().getString(R.string.drag_select_mode));
mDrag=new ImageView(context);
mDrag.setImageResource(R.mipmap.ic_sort_white_36dp);
mDrag.setOnClickListener(this);
mDrag.setContentDescription(getContext().getString(R.string.drag_mode));
mType=new ImageView(context);
mType.setImageResource(R.mipmap.bigbang_action_cloud);
mType.setOnClickListener(this);
mType.setContentDescription(getContext().getString(R.string.offline_segment));
mSelectOther=new ImageView(context);
mSelectOther.setImageResource(R.mipmap.bigbang_action_select_other);
mSelectOther.setOnClickListener(this);
mSelectOther.setContentDescription(getContext().getString(R.string.select_other));
mSymbol=new ImageView(context);
mSymbol.setImageResource(R.mipmap.bigbang_action_symbol);
mSymbol.setOnClickListener(this);
mSymbol.setContentDescription(getContext().getString(R.string.no_symbol));
mSection=new ImageView(context);
mSection.setImageResource(R.mipmap.bigbang_action_enter);
mSection.setOnClickListener(this);
mSection.setContentDescription(getContext().getString(R.string.no_section));
addView(mDragSelect, createLayoutParams());
addView(mDrag, createLayoutParams());
addView(mType, createLayoutParams());
addView(mSelectOther, createLayoutParams());
addView(mSection, createLayoutParams());
addView(mSymbol, createLayoutParams());
setWillNotDraw(false);
mActionGap = (int) ViewUtil.dp2px(5);
mContentPadding = (int) ViewUtil.dp2px(10);
}
示例15: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings_dots_layout);
//Show back button
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
ab.setHomeAsUpIndicator(R.mipmap.ic_arrow_back_white_24dp);
}
//Speak the title of the activity
Common.defaultTextSpeech.speechText(getString(R.string.dots_layout));
//Declaration
brailleCellCheckBox = (ImageView) findViewById(R.id.brailleCellCheckBox);
perkinsLayoutCheckBox = (ImageView) findViewById(R.id.perkinsLayoutCheckBox);
twoDotsLayoutCheckBox = (ImageView) findViewById(R.id.twoDotsLayoutCheckBox);
//Check if multi-touch supported
PackageManager pm = getPackageManager();
hasSixMultiTouch = pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND);
//Load default layout
int selectedDotsLayout = Common.selectedDotsLayout;
if (selectedDotsLayout == Common.BRAILLE_CELL_DOTS_LAYOUT) {
brailleCellCheckBox.setImageResource(R.mipmap.ic_radio_button_checked_green_24dp);
brailleCellCheckBox.setContentDescription(getString(R.string.braille_cell_layout_selected));
perkinsLayoutCheckBox.setImageResource(R.mipmap.ic_radio_button_unchecked_green_24dp);
perkinsLayoutCheckBox.setContentDescription(getString(R.string.perkins_layout_not_selected));
twoDotsLayoutCheckBox.setImageResource(R.mipmap.ic_radio_button_unchecked_green_24dp);
twoDotsLayoutCheckBox.setContentDescription(getString(R.string.two_rows_layout_not_selected));
} else if (selectedDotsLayout == Common.PERKINS_DOTS_LAYOUT) {
brailleCellCheckBox.setImageResource(R.mipmap.ic_radio_button_unchecked_green_24dp);
brailleCellCheckBox.setContentDescription(getString(R.string.braille_cell_layout_not_selected));
perkinsLayoutCheckBox.setImageResource(R.mipmap.ic_radio_button_checked_green_24dp);
perkinsLayoutCheckBox.setContentDescription(getString(R.string.perkins_layout_selected));
twoDotsLayoutCheckBox.setImageResource(R.mipmap.ic_radio_button_unchecked_green_24dp);
twoDotsLayoutCheckBox.setContentDescription(getString(R.string.two_rows_layout_not_selected));
} else if (selectedDotsLayout == Common.TWO_ROWS_DOTS_LAYOUT) {
brailleCellCheckBox.setImageResource(R.mipmap.ic_radio_button_unchecked_green_24dp);
brailleCellCheckBox.setContentDescription(getString(R.string.braille_cell_layout_not_selected));
perkinsLayoutCheckBox.setImageResource(R.mipmap.ic_radio_button_unchecked_green_24dp);
perkinsLayoutCheckBox.setContentDescription(getString(R.string.perkins_layout_not_selected));
twoDotsLayoutCheckBox.setImageResource(R.mipmap.ic_radio_button_checked_green_24dp);
twoDotsLayoutCheckBox.setContentDescription(getString(R.string.two_rows_layout_selected));
}
} catch (Exception e) {
e.printStackTrace();
}
}