本文整理汇总了Java中android.widget.ImageView类的典型用法代码示例。如果您正苦于以下问题:Java ImageView类的具体用法?Java ImageView怎么用?Java ImageView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageView类属于android.widget包,在下文中一共展示了ImageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAccessoryView
import android.widget.ImageView; //导入依赖的package包/类
private static ImageView getAccessoryView(ATableViewCell cell, ATableViewCellAccessoryType accessoryType) {
LinearLayout containerView = (LinearLayout) cell.findViewById(R.id.containerView);
// check if accessoryView already exists for current cell before creating a new instance.
ImageView accessoryView = (ImageView) containerView.findViewById(R.id.accessoryView);
if (accessoryView == null) {
Resources res = cell.getResources();
// get marginRight for accessoryView, DisclosureButton has a different one.
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
int marginRight = (int) res.getDimension(R.dimen.atv_cell_content_margin);
if (accessoryType == ATableViewCellAccessoryType.DisclosureButton) {
marginRight = (int) res.getDimension(R.dimen.atv_cell_disclosure_button_margin_right);
}
params.setMargins(0, 0, marginRight, 0);
// setup.
accessoryView = new ATableViewCellAccessoryView(cell.getContext());
accessoryView.setId(R.id.accessoryView);
accessoryView.setLayoutParams(params);
containerView.addView(accessoryView);
}
return accessoryView;
}
示例2: addItemWithIconTitleSubtitle
import android.widget.ImageView; //导入依赖的package包/类
public ItemBuilder addItemWithIconTitleSubtitle(int icon, String title, String subtitle) {
view = inflater.inflate(R.layout.item_element_icon_title_subtitle, parent, false);
ImageView iv = (ImageView) view.findViewById(R.id.iv_icon);
iv.setImageResource(icon);
TextView tv = (TextView) view.findViewById(R.id.tv_title);
tv.setText(title);
TextView tv2 = (TextView) view.findViewById(R.id.tv_subtitle);
tv2.setText(subtitle);
return this;
}
示例3: onBtnNClicked
import android.widget.ImageView; //导入依赖的package包/类
public void onBtnNClicked(View view) {
if (mVideoPreProcessing == null) {
mVideoPreProcessing = new VideoPreProcessing();
}
ImageView iv = (ImageView) view;
Object showing = view.getTag();
if (showing != null && (Boolean) showing) {
mVideoPreProcessing.enablePreProcessing(false);
iv.setTag(null);
iv.clearColorFilter();
} else {
mVideoPreProcessing.enablePreProcessing(true);
iv.setTag(true);
iv.setColorFilter(getResources().getColor(R.color.agora_blue), PorterDuff.Mode.MULTIPLY);
}
}
示例4: onVoiceMuteClicked
import android.widget.ImageView; //导入依赖的package包/类
public void onVoiceMuteClicked(View view) {
log.info("onVoiceMuteClicked " + view + " " + mUidsList.size() + " video_status: " + mVideoMuted + " audio_status: " + mAudioMuted);
if (mUidsList.size() == 0) {
return;
}
RtcEngine rtcEngine = rtcEngine();
rtcEngine.muteLocalAudioStream(mAudioMuted = !mAudioMuted);
ImageView iv = (ImageView) view;
if (mAudioMuted) {
iv.setColorFilter(getResources().getColor(R.color.agora_blue), PorterDuff.Mode.MULTIPLY);
} else {
iv.clearColorFilter();
}
}
示例5: onCreate
import android.widget.ImageView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.detail_layout);
imageDetail = (ImageView)findViewById(R.id.image_detail);
spot = (TextView)findViewById(R.id.spot_detail);
time = (TextView)findViewById(R.id.time_detail);
reward = (TextView)findViewById(R.id.reward_detail);
username = (TextView)findViewById(R.id.username_detail);
ps = (TextView)findViewById(R.id.ps_detail);
imageDetail.setBackgroundResource(getIntent().getIntExtra("headId", 0));
spot.setText(getIntent().getStringExtra("spot"));
time.setText(getIntent().getStringExtra("time"));
reward.setText(getIntent().getStringExtra("reward"));
username.setText(getIntent().getStringExtra("username"));
ps.setText(getIntent().getStringExtra("ps"));
}
示例6: onViewCreated
import android.widget.ImageView; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
xyPlot = (XYPlot) view.findViewById(R.id.accelerationGraph);
badText = (TextView) view.findViewById(R.id.badText);
normalText = (TextView) view.findViewById(R.id.normalText);
goodText = (TextView) view.findViewById(R.id.goodText);
perfectText = (TextView) view.findViewById(R.id.perfectText);
distanceValueText = (TextView) view.findViewById(R.id.distanceValueText);
speedText = (TextView) view.findViewById(R.id.speedText);
speedValueText = (TextView) view.findViewById(R.id.speedValueText);
bumpValueText = (TextView) view.findViewById(R.id.bumpValueText);
badQualityText = (TextView) view.findViewById(R.id.badQualityText);
normalQualityText = (TextView) view.findViewById(R.id.normalQualityText);
goodQualityText = (TextView) view.findViewById(R.id.goodQualityText);
perfectQualityText = (TextView) view.findViewById(R.id.perfectQualityText);
deviceIndicatorAngleBtn = (ImageView) view.findViewById(R.id.wrong_angle_icon);
gpsIndicatorBtn = (ImageView) view.findViewById(R.id.wrong_gps_icon);
startMeasurementsBtn = (Button) view.findViewById(R.id.startMeasurementsBtn);
roadIntervalValue = (TextView) view.findViewById(R.id.roadIntervalValue);
roadIntervalText = (TextView) view.findViewById(R.id.roadIntervalText);
recordStatusValue = (TextView) view.findViewById(R.id.recordStatusValue);
itemsCntValueText = (TextView) view.findViewById(R.id.itemsCntValueText);
intervalsCntValueText = (TextView) view.findViewById(R.id.intervalsCntValueText);
initUI();
}
示例7: setupChildren
import android.widget.ImageView; //导入依赖的package包/类
private void setupChildren() {
topbar = new LinearLayout(getContext());
topbar.setOrientation(LinearLayout.HORIZONTAL);
topbar.setClipChildren(false);
topbar.setClipToPadding(false);
addView(topbar, new LayoutParams(1));
buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
title.setGravity(Gravity.CENTER);
topbar.addView(title, new LinearLayout.LayoutParams(
0, LayoutParams.MATCH_PARENT, DEFAULT_DAYS_IN_WEEK - 2
));
buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
pager.setId(R.id.mcv_pager);
pager.setOffscreenPageLimit(1);
addView(pager, new LayoutParams(calendarMode.visibleWeeksCount + DAY_NAMES_ROW));
}
示例8: showSupportersDialog
import android.widget.ImageView; //导入依赖的package包/类
private void showSupportersDialog() {
final Dialog fullscreenDialog = new Dialog(this, R.style.DialogFullscreen);
fullscreenDialog.setContentView(R.layout.dialog_supporters);
Button logoutB = fullscreenDialog.findViewById(R.id.logout_b);
ImageView img_dialog_fullscreen_close = fullscreenDialog.findViewById(R.id.close_iv);
TextView collaborationTV = fullscreenDialog.findViewById(R.id.info_collaboration_tv);
collaborationTV.setText(Html.fromHtml(getString(R.string.collaboration)));
img_dialog_fullscreen_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fullscreenDialog.dismiss();
}
});
logoutB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
saveToken(context, "HOME", null);
Intent intent = new Intent(context, ActivitySplash.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK |
Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});
fullscreenDialog.show();
}
示例9: getChildView
import android.widget.ImageView; //导入依赖的package包/类
/**
* Instantiate a child view containing the user you following's habit and their individual completion status
* @param groupPosition
* @param childPosition
* @param isExpanded
* @param convertView
* @param parent
* @return
*/
@Override
public View getChildView(int groupPosition, int childPosition, boolean isExpanded, View convertView, ViewGroup parent) {
Habit habit = (Habit) getChild(groupPosition, childPosition);
if(convertView == null) {
convertView = mInflater.inflate(R.layout.item_following_habit, parent, false);
}
TextView titleView = (TextView) convertView.findViewById(R.id.following_habit_title);
titleView.setText(habit.getTitle());
ImageView indicatorView = (ImageView) convertView.findViewById(R.id.following_habit_indicator);
if (habit.getStatus() != null) {
indicatorView.setColorFilter(habit.getStatus().getColor());
}
return convertView;
}
示例10: updateSelectView
import android.widget.ImageView; //导入依赖的package包/类
/**
* 刷新选中的布局
*/
private void updateSelectView() {
mSelectContainer.removeAllViews();
if (mSelectedFriends.size() == 0)
mHorizontalScrollView.setVisibility(View.GONE);
else {
mHorizontalScrollView.setVisibility(View.VISIBLE);
for (final Author author : mSelectedFriends) {
ImageView ivIcon = (ImageView) LayoutInflater.from(this)
.inflate(R.layout.activity_main_select_friend_label_container_item, mSelectContainer, false);
ivIcon.setTag(R.id.iv_show_icon, author);
ivIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Author tag = (Author) v.getTag(R.id.iv_show_icon);
onSelectIconClick(tag);
mSelectContainer.removeView(v);
}
});
mSelectContainer.addView(ivIcon);
Glide.with(this).load(author.getPortrait()).error(R.mipmap.widget_default_face).into(ivIcon);
}
}
}
示例11: getView
import android.widget.ImageView; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
if (convertView == null)
{
convertView = inflater.inflate(R.layout.view_list_musicrows, parent, false);
ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT);
convertView.setLayoutParams(layoutParams);
};
ImageView album = (ImageView) convertView.findViewById(R.id.view_album);
album.setImageDrawable(context.getResources().getDrawable(android.R.drawable.ic_menu_report_image));
TextView title = (TextView) convertView.findViewById(R.id.view_title);
TextView artist = (TextView) convertView.findViewById(R.id.view_artist);
title.setText(list.get(position).title);
artist.setText(list.get(position).artist + " - " + list.get(position).album + " - " + global.mMusicManager.convertToTime(list.get(position).length));
convertView.setTag(list.get(position).uid);
MyAsyncTask myAsyncTask = new MyAsyncTask();
myAsyncTask.setImgView(album);
myAsyncTask.execute(position + "");
return convertView;
}
示例12: setScale
import android.widget.ImageView; //导入依赖的package包/类
@Override
public void setScale(float scale, float focalX, float focalY,
boolean animate) {
ImageView imageView = getImageView();
if (null != imageView) {
// Check to see if the scale is within bounds
if (scale < mMinScale || scale > mMaxScale) {
Logger.i("Scale must be within the range of minScale and maxScale");
return;
}
if (animate) {
imageView.post(new AnimatedZoomRunnable(getScale(), scale,
focalX, focalY));
} else {
mSuppMatrix.setScale(scale, scale, focalX, focalY);
checkAndDisplayMatrix();
}
}
}
示例13: getView
import android.widget.ImageView; //导入依赖的package包/类
/**
* Return row for each country
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View cellView = convertView;
Cell cell;
Country country = countries.get(position);
if (convertView == null) {
cell = new Cell();
cellView = inflater.inflate(R.layout.row, null);
cell.textView = (TextView) cellView.findViewById(R.id.row_title);
cell.imageView = (ImageView) cellView.findViewById(R.id.row_icon);
cellView.setTag(cell);
} else {
cell = (Cell) cellView.getTag();
}
cell.textView.setText(country.getName());
// Load drawable dynamically from country code
String drawableName = "flag_"
+ country.getCode().toLowerCase(Locale.ENGLISH);
cell.imageView.setImageResource(getResId(drawableName));
return cellView;
}
示例14: initView
import android.widget.ImageView; //导入依赖的package包/类
private void initView(Context context) {
View.inflate(context, R.layout.dialog_loading_tip, this);
img_tip_logo = (ImageView) findViewById(R.id.img_tip_logo);
progress = (ProgressBar) findViewById(R.id.progress);
tv_tips = (TextView) findViewById(R.id.tv_tips);
bt_operate = (Button) findViewById(R.id.bt_operate);
//重新尝试
bt_operate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(onReloadListener!=null){
onReloadListener.reload();
}
}
});
setVisibility(View.GONE);
}
示例15: initView
import android.widget.ImageView; //导入依赖的package包/类
private void initView() {
mRelativeLayout = (RelativeLayout) findViewById(R.id.rl_main);
push_state_ll = (LinearLayout) findViewById(R.id.push_state_ll);
settings = (ImageView) findViewById(R.id.iv_settings);
settings.setOnClickListener(this);
wx_user_name = (TextView) findViewById(R.id.wx_user_name_tv);
wx_user_icon = (CircleImageView) findViewById(R.id.wx_user_icon_iv);
mCountTimeView = (CountTimeView) findViewById(R.id.count_time_view);
mRecorderButton = (ImageView) findViewById(R.id.iv_push);
mRecorderButton.setOnClickListener(this);
btn_pop_pro = (ImageView) findViewById(R.id.btn_pro);
btn_pop_pro.setOnClickListener(this);
btn_pop_talk = (ImageView) findViewById(R.id.btn_talk);
btn_pop_talk.setOnClickListener(this);
mTv_watch_person = (TextView) findViewById(R.id.tv_watch_person);
mRelativeLayout.setOnTouchListener(this);
}