下面列出了android.widget.ImageView#setContentDescription ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drink);
//Get the drink from the intent
int drinkNo = (Integer)getIntent().getExtras().get(EXTRA_DRINKNO);
Drink drink = Drink.drinks[drinkNo];
//Populate the drink image
ImageView photo = (ImageView)findViewById(R.id.photo);
photo.setImageResource(drink.getImageResourceId());
photo.setContentDescription(drink.getName());
//Populate the drink name
TextView name = (TextView)findViewById(R.id.name);
name.setText(drink.getName());
//Populate the drink description
TextView description = (TextView)findViewById(R.id.description);
description.setText(drink.getDescription());
}
private void setCameraFlashModeIcon(ImageView imageView, String mode) {
switch (mode) {
case Camera.Parameters.FLASH_MODE_OFF:
imageView.setImageResource(R.drawable.flash_off);
imageView.setContentDescription(LocaleController.getString("AccDescrCameraFlashOff", R.string.AccDescrCameraFlashOff));
break;
case Camera.Parameters.FLASH_MODE_ON:
imageView.setImageResource(R.drawable.flash_on);
imageView.setContentDescription(LocaleController.getString("AccDescrCameraFlashOn", R.string.AccDescrCameraFlashOn));
break;
case Camera.Parameters.FLASH_MODE_AUTO:
imageView.setImageResource(R.drawable.flash_auto);
imageView.setContentDescription(LocaleController.getString("AccDescrCameraFlashAuto", R.string.AccDescrCameraFlashAuto));
break;
}
}
@Override
public Object instantiateItem(ViewGroup container, final int position) {
if (context.get() != null) {
final int drawableId = theme.getImageList().get(position + 1);
final ImageView view = new ImageView(context.get());
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
view.setContentDescription(context.get().getResources().getString(R.string
.content_desc_poempic));
view.setScaleType(ImageView.ScaleType.CENTER_CROP);
view.setAdjustViewBounds(true);
view.setTag(drawableId);
container.addView(view, 0);
view.post(new Runnable() {
@Override
public void run() {
ImageLoader.getImageLoader().load(drawableId, view);
}
});
return view;
}
return null;
}
/**
* 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;
}
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);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_instructions, container, false);
ImageView instructionImage = (ImageView) rootView.findViewById(R.id.instruction_image);
TextView instructionText = (TextView) rootView.findViewById(R.id.instruction_text);
int instructionImageContentDescriptionId = getTextByPageNumber();
if (instructionImageContentDescriptionId != NOT_AN_ID) {
Typeface typeface = Typefaces.get(getActivity(), Typefaces.Font.TWOBIT);
instructionText.setText(instructionImageContentDescriptionId);
instructionText.setTypeface(typeface);
instructionImage.setContentDescription(getString(instructionImageContentDescriptionId));
}
int instructionImageDrawableId = getDrawableByPageNumber();
if (instructionImageDrawableId != NOT_AN_ID) instructionImage.setImageResource(instructionImageDrawableId);
return rootView;
}
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);
}
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);
}
private void addIconTab(final int position, Drawable drawable, CharSequence contentDescription) {
ImageView tab = new ImageView(getContext()) {
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (pager.getAdapter() instanceof IconTabProvider) {
((IconTabProvider) pager.getAdapter()).customOnDraw(canvas, position);
}
}
@Override
public void setSelected(boolean selected) {
super.setSelected(selected);
Drawable background = getBackground();
if (Build.VERSION.SDK_INT >= 21 && background != null) {
int color = Theme.getColor(selected ? Theme.key_chat_emojiPanelIconSelected : Theme.key_chat_emojiBottomPanelIcon);
Theme.setSelectorDrawableColor(background, Color.argb(30, Color.red(color), Color.green(color), Color.blue(color)), true);
}
}
};
tab.setFocusable(true);
if (Build.VERSION.SDK_INT >= 21) {
RippleDrawable rippleDrawable = (RippleDrawable) Theme.createSelectorDrawable(Theme.getColor(Theme.key_chat_emojiBottomPanelIcon));
Theme.setRippleDrawableForceSoftware(rippleDrawable);
tab.setBackground(rippleDrawable);
}
tab.setImageDrawable(drawable);
tab.setScaleType(ImageView.ScaleType.CENTER);
tab.setOnClickListener(v -> {
if (pager.getAdapter() instanceof IconTabProvider) {
if (!((IconTabProvider) pager.getAdapter()).canScrollToTab(position)) {
return;
}
}
pager.setCurrentItem(position, false);
});
tabsContainer.addView(tab);
tab.setSelected(position == currentPosition);
tab.setContentDescription(contentDescription);
}
public void setCardDeviceClass(Class<? extends CardDevice> cardDeviceClass) {
ImageView device = findViewById(R.id.device);
CardDevice.Metadata metadata = cardDeviceClass.getAnnotation(CardDevice.Metadata.class);
device.setImageDrawable(ContextCompat.getDrawable(getContext(), metadata.iconId()));
device.setContentDescription(metadata.name());
}
public void setCardDataClass(Class<? extends CardData> cardDataClass) {
ImageView type = findViewById(R.id.type);
CardData.Metadata metadata = cardDataClass.getAnnotation(CardData.Metadata.class);
type.setImageDrawable(ContextCompat.getDrawable(getContext(), metadata.iconId()));
type.setContentDescription(metadata.name());
}
@SuppressLint("PrivateResource")
void setAltText(ImageView imageView, String description) {
if (!TextUtils.isEmpty(description)) {
imageView.setContentDescription(description);
} else {
imageView.setContentDescription(CONTENT_DESC);
}
}
public ThemeCell(Context context, boolean nightTheme) {
super(context);
setWillNotDraw(false);
isNightTheme = nightTheme;
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
paintStroke.setStyle(Paint.Style.STROKE);
paintStroke.setStrokeWidth(AndroidUtilities.dp(2));
textView = new TextView(context);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 53 + 48 + 4 : 60, 0, LocaleController.isRTL ? 60 : 53 + 48 + 4, 0));
checkImage = new ImageView(context);
checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
checkImage.setImageResource(R.drawable.sticker_added);
if (!isNightTheme) {
addView(checkImage, LayoutHelper.createFrame(19, 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 21 + 38, 0, 21 + 38, 0));
optionsButton = new ImageView(context);
optionsButton.setFocusable(false);
optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector)));
optionsButton.setImageResource(R.drawable.ic_ab_other);
optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
optionsButton.setScaleType(ImageView.ScaleType.CENTER);
optionsButton.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
addView(optionsButton, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP));
} else {
addView(checkImage, LayoutHelper.createFrame(19, 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 21, 0, 21, 0));
}
}
private void populateRepView(View repView, Contact contact, final int index,
List<String> previousCalls) {
TextView contactName = repView.findViewById(R.id.contact_name);
final ImageView repImage = repView.findViewById(R.id.rep_image);
ImageView contactChecked = repView.findViewById(R.id.contact_done_img);
TextView contactReason = repView.findViewById(R.id.contact_reason);
TextView contactWarning = repView.findViewById(R.id.contact_warning);
contactName.setText(contact.name);
contactWarning.setVisibility(View.GONE);
if (!TextUtils.isEmpty(contact.area)) {
contactReason.setText(contact.area);
if (TextUtils.equals(contact.area, "US House") && mIssue.isSplit) {
contactWarning.setVisibility(View.VISIBLE);
contactWarning.setText(R.string.split_district_warning);
}
contactReason.setVisibility(View.VISIBLE);
} else {
contactReason.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(contact.photoURL)) {
repImage.setVisibility(View.VISIBLE);
Glide.with(getApplicationContext())
.load(contact.photoURL)
.asBitmap()
.centerCrop()
.into(new BitmapImageViewTarget(repImage) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(
repImage.getContext().getResources(), resource);
drawable.setCircular(true);
drawable.setGravity(Gravity.TOP);
repImage.setImageDrawable(drawable);
}
});
} else {
repImage.setVisibility(View.GONE);
}
// Show a bit about whether they've been contacted yet
if (previousCalls.size() > 0) {
contactChecked.setImageLevel(1);
contactChecked.setContentDescription(getResources().getString(
R.string.contact_done_img_description));
} else {
contactChecked.setImageLevel(0);
contactChecked.setContentDescription(null);
}
repView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getApplicationContext(), RepCallActivity.class);
intent.putExtra(KEY_ISSUE, mIssue);
intent.putExtra(RepCallActivity.KEY_ADDRESS,
getIntent().getStringExtra(RepCallActivity.KEY_ADDRESS));
intent.putExtra(RepCallActivity.KEY_ACTIVE_CONTACT_INDEX, index);
startActivity(intent);
}
});
}
public ChatAvatarContainer(Context context, ChatActivity chatActivity, boolean needTime) {
super(context);
parentFragment = chatActivity;
if (parentFragment != null) {
sharedMediaPreloader = new SharedMediaLayout.SharedMediaPreloader(chatActivity);
}
avatarImageView = new BackupImageView(context);
avatarImageView.setRoundRadius(AndroidUtilities.dp(21));
addView(avatarImageView);
if (parentFragment != null && !parentFragment.isInScheduleMode()) {
avatarImageView.setOnClickListener(v -> openProfile(true));
}
titleTextView = new SimpleTextView(context);
titleTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle));
titleTextView.setTextSize(18);
titleTextView.setGravity(Gravity.LEFT);
titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
titleTextView.setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f));
addView(titleTextView);
subtitleTextView = new SimpleTextView(context);
subtitleTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubtitle));
subtitleTextView.setTag(Theme.key_actionBarDefaultSubtitle);
subtitleTextView.setTextSize(14);
subtitleTextView.setGravity(Gravity.LEFT);
addView(subtitleTextView);
if (needTime) {
timeItem = new ImageView(context);
timeItem.setPadding(AndroidUtilities.dp(10), AndroidUtilities.dp(10), AndroidUtilities.dp(5), AndroidUtilities.dp(5));
timeItem.setScaleType(ImageView.ScaleType.CENTER);
timeItem.setImageDrawable(timerDrawable = new TimerDrawable(context));
addView(timeItem);
timeItem.setOnClickListener(v -> parentFragment.showDialog(AlertsCreator.createTTLAlert(getContext(), parentFragment.getCurrentEncryptedChat()).create()));
timeItem.setContentDescription(LocaleController.getString("SetTimer", R.string.SetTimer));
}
if (parentFragment != null && !parentFragment.isInScheduleMode()) {
setOnClickListener(v -> openProfile(false));
TLRPC.Chat chat = parentFragment.getCurrentChat();
statusDrawables[0] = new TypingDotsDrawable();
statusDrawables[1] = new RecordStatusDrawable();
statusDrawables[2] = new SendingFileDrawable();
statusDrawables[3] = new PlayingGameDrawable();
statusDrawables[4] = new RoundStatusDrawable();
for (int a = 0; a < statusDrawables.length; a++) {
statusDrawables[a].setIsChat(chat != null);
}
}
}
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.timecat_action_cloud);
mType.setOnClickListener(this);
mType.setContentDescription(getContext().getString(R.string.offline_segment));
mSelectOther = new ImageView(context);
mSelectOther.setImageResource(R.mipmap.timecat_action_select_other);
mSelectOther.setOnClickListener(this);
mSelectOther.setContentDescription(getContext().getString(R.string.select_other));
mSymbol = new ImageView(context);
mSymbol.setImageResource(R.mipmap.timecat_action_symbol);
mSymbol.setOnClickListener(this);
mSymbol.setContentDescription(getContext().getString(R.string.no_symbol));
mSection = new ImageView(context);
mSection.setImageResource(R.mipmap.timecat_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 = ViewUtil.dp2px(5);
mContentPadding = ViewUtil.dp2px(10);
}
public ThemeCell(Context context, boolean nightTheme) {
super(context);
setWillNotDraw(false);
isNightTheme = nightTheme;
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
paintStroke.setStyle(Paint.Style.STROKE);
paintStroke.setStrokeWidth(AndroidUtilities.dp(2));
textView = new TextView(context);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
textView.setLines(1);
textView.setMaxLines(1);
textView.setSingleLine(true);
textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 53 + 48 + 4 : 60, 0, LocaleController.isRTL ? 60 : 53 + 48 + 4, 0));
checkImage = new ImageView(context);
checkImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_featuredStickers_addedIcon), PorterDuff.Mode.MULTIPLY));
checkImage.setImageResource(R.drawable.sticker_added);
if (!isNightTheme) {
addView(checkImage, LayoutHelper.createFrame(19, 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 21 + 38, 0, 21 + 38, 0));
optionsButton = new ImageView(context);
optionsButton.setFocusable(false);
optionsButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector)));
optionsButton.setImageResource(R.drawable.ic_ab_other);
optionsButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY));
optionsButton.setScaleType(ImageView.ScaleType.CENTER);
optionsButton.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
addView(optionsButton, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP));
} else {
addView(checkImage, LayoutHelper.createFrame(19, 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.CENTER_VERTICAL, 21, 0, 21, 0));
}
}
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);
}
@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;
}
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);
}