本文整理了Java中android.widget.ImageView.setMinimumWidth()
方法的一些代码示例,展示了ImageView.setMinimumWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setMinimumWidth()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setMinimumWidth
暂无
代码示例来源:origin: stackoverflow.com
//byte[] chartData
ImageView imgViewer = (ImageView) findViewById(R.id.chart_image);
Bitmap bm = BitmapFactory.decodeByteArray(chartData, 0, chartData.length);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
imgViewer.setMinimumHeight(dm.heightPixels);
imgViewer.setMinimumWidth(dm.widthPixels);
imgViewer.setImageBitmap(bm);
代码示例来源:origin: stackoverflow.com
protected ImageView createDefaultImageView(Context context) {
ImageView imageView = new ImageView(context);
int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
imageView.setPadding(padding, padding, padding, padding);
int width = (int) (getResources().getDisplayMetrics().widthPixels / mViewPager.getAdapter().getCount());
imageView.setMinimumWidth(width);
return imageView;
}
代码示例来源:origin: Flipboard/bottomsheet
thumb.setMinimumWidth(thumbnailSize);
thumb.setMinimumHeight(thumbnailSize);
thumb.setMaxHeight(thumbnailSize);
代码示例来源:origin: scwang90/SmartRefreshLayout
@NonNull
@Override
public SmartViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
FlexboxLayoutManager.LayoutParams lp = new FlexboxLayoutManager.LayoutParams(-2,-2);
lp.setFlexGrow(1);
lp.bottomMargin = DensityUtil.dp2px(2.5f);
lp.topMargin = DensityUtil.dp2px(2.5f);
lp.leftMargin = DensityUtil.dp2px(2.5f);
lp.rightMargin = DensityUtil.dp2px(2.5f);
ImageView imageVIew = new ImageView(parent.getContext());
imageVIew.setMinimumWidth(DensityUtil.dp2px(90f));
imageVIew.setMinimumHeight(DensityUtil.dp2px(90f));
imageVIew.setLayoutParams(lp);
return new SmartViewHolder(imageVIew, mListener);
}
});
代码示例来源:origin: stackoverflow.com
ImageView imgViewer = (ImageView) findViewById(id.of.your.img_viewer);
Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
imgViewer.setMinimumHeight(dm.heightPixels);
imgViewer.setMinimumWidth(dm.widthPixels);
imgViewer.setImageBitmap(bm);
代码示例来源:origin: stackoverflow.com
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_movie, parent, false);
ImageView viewById = (ImageView) view.findViewById(R.id.poster);
viewById.setMinimumWidth(newWidth);
viewById.setMinimumHeight(newHeight);
return new ViewHolder(view);
}
代码示例来源:origin: stackoverflow.com
ImageView bmImage = (ImageView)this.findViewById(R.id.MyImage);
String urldisplay = urls[0];
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(urldisplay).openStream();
mIcon11 = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
bmImage.setImageBitmap(mIcon11);
if(mIcon11 != null){
int width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mIcon11.getWidth(), this.getResources().getDisplayMetrics());
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mIcon11.getHeight(), this.getResources().getDisplayMetrics());
bmImage.setMinimumWidth(width);
bmImage.setMinimumHeight(height);
}
代码示例来源:origin: stackoverflow.com
this.menu = menu;
this.menu.add("calendar");
ImageView imageView = new ImageView(getActivity());
imageView.setMinimumHeight(128);
imageView.setMinimumWidth(128);
imageView.setImageDrawable(yourDrawable);
MenuItem item = this.menu.getItem(0);
item.setActionView(imageView);
代码示例来源:origin: Tencent/RapidView
public void run(RapidParserObject object, Object view, Var value) {
int width = 0;
String str = value.getString();
if( str.length() >= 1 && str.substring(str.length() - 1).compareToIgnoreCase("%") == 0 ){
float percent = Float.parseFloat(str.substring(0, str.length() - 1)) / 100;
width = (int)(percent * object.mScreenWidth);
}
else if( str.length() >= 2 && str.substring(str.length() - 2).compareToIgnoreCase("%x") == 0 ){
float percent = Float.parseFloat(str.substring(0, str.length() - 2)) / 100;
width = (int)(percent * object.mScreenWidth);
}
else if( str.length() >= 2 && str.substring(str.length() - 2).compareToIgnoreCase("%y") == 0 ){
float percent = Float.parseFloat(str.substring(0, str.length() - 2)) / 100;
width = (int)(percent * object.mScreenHeight);
}
else{
width = ViewUtils.dip2px(object.mContext, value.getFloat());
}
((ImageView)view).setMinimumWidth(width);
}
}
代码示例来源:origin: stackoverflow.com
Private Menu menu
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
this.menu = menu;
ImageView imageView = new ImageView(getActivity());
imageView.setMinimumHeight(128);
imageView.setMinimumWidth(128);
imageView.setImageDrawable(yourDrawable);
MenuItem item = this.menu.getItem(0);
item.setActionView(imageView);
return true;
}
代码示例来源:origin: liuzho/ONE
private void initMovieHolder(RecyclerView.ViewHolder holder, ContentList content) {
if (content.tag_list.size() != 0) {
((MovieHolder) holder).tv_type.setText("- " + content.tag_list.get(0).title + " -");
} else {
((MovieHolder) holder).tv_type.setText("- 影视 -");
}
((MovieHolder) holder).tv_title.setText(content.title);
((MovieHolder) holder).tv_author.setText("文/" + content.author.user_name);
((MovieHolder) holder).tv_forward.setText(content.forward);
((MovieHolder) holder).tv_subtitle.setText("--《" + content.subtitle + "》");
int post_time = Integer.valueOf(DateUtil.getFmtH()) - 6;
((MovieHolder) holder).tv_post_time.setText(post_time + "小时前");
((MovieHolder) holder).tv_lick_count.setText(content.like_count.toString());
Picasso.with(App.getContext())
.load(content.img_url)
.placeholder(R.drawable.placeholder)
.into(((MovieHolder) holder).iv_img);
((MovieHolder) holder).iv_img.setMaxWidth(mWinWidth - DensityUtil.dip2px(90));
((MovieHolder) holder).iv_img.setMinimumWidth(mWinWidth - DensityUtil.dip2px(90));
((MovieHolder) holder).iv_img.setMaxHeight(mWinWidth * 4);
}
代码示例来源:origin: liuzho/ONE
.into(((OneDayHolder) holder).iv_img);
((OneDayHolder) holder).iv_img.setMaxWidth(mWinWidth);
((OneDayHolder) holder).iv_img.setMinimumWidth(mWinWidth);
((OneDayHolder) holder).iv_img.setMaxHeight(mWinWidth * 5);
((OneDayHolder) holder).iv_img.setOnClickListener(new View.OnClickListener() {
代码示例来源:origin: cyclestreets/android
iv.setMinimumWidth(POICategories.IconSize * 2);
代码示例来源:origin: liuzho/ONE
.into(((ReadHolder) holder).iv_img);
((ReadHolder) holder).iv_img.setMaxWidth(mWinWidth - DensityUtil.dip2px(90));
((ReadHolder) holder).iv_img.setMinimumWidth(mWinWidth - DensityUtil.dip2px(90));
((ReadHolder) holder).iv_img.setMaxHeight(mWinWidth * 5);
代码示例来源:origin: bitstadium/HockeySDK-Android
private void configureViewForPlaceholder(final boolean openOnClick) {
mTextView.setMaxWidth(mWidthPortrait);
mTextView.setMinWidth(mWidthPortrait);
mImageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams
.WRAP_CONTENT));
mImageView.setAdjustViewBounds(false);
mImageView.setBackgroundColor(Color.parseColor("#eeeeee"));
mImageView.setMinimumHeight((int) (mWidthPortrait * 1.2f));
mImageView.setMinimumWidth(mWidthPortrait);
mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
mImageView.setImageDrawable(getSystemIcon("ic_menu_attachment"));
mImageView.setContentDescription(mTextView.getText());
mImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!openOnClick) {
return;
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(mAttachmentUri, "*/*");
mContext.startActivity(intent);
}
});
}
代码示例来源:origin: bitstadium/HockeySDK-Android
private void configureViewForThumbnail(Bitmap bitmap, final boolean openOnClick) {
int width = mOrientation == ImageUtils.ORIENTATION_LANDSCAPE ? mWidthLandscape : mWidthPortrait;
int height = mOrientation == ImageUtils.ORIENTATION_LANDSCAPE ? mMaxHeightLandscape :
mMaxHeightPortrait;
mTextView.setMaxWidth(width);
mTextView.setMinWidth(width);
mImageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams
.WRAP_CONTENT));
mImageView.setAdjustViewBounds(true);
mImageView.setMinimumWidth(width);
mImageView.setMaxWidth(width);
mImageView.setMaxHeight(height);
mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
mImageView.setImageBitmap(bitmap);
mImageView.setContentDescription(mTextView.getText());
mImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!openOnClick) {
return;
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(mAttachmentUri, "image/*");
mContext.startActivity(intent);
}
});
}
代码示例来源:origin: onionApps/Chat.onion
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
int s = (int) (Math.min(displayRectangle.width(), displayRectangle.height()) * 0.9);
view.setMinimumWidth(s);
view.setMinimumHeight(s);
new AlertDialog.Builder(this)
代码示例来源:origin: liuzho/ONE
public void setData(final Context context, String volume, String info, final String url) {
mTvVolume.setText(volume);
mTvInfo.setText(info);
Picasso.with(context)
.load(url)
.placeholder(R.drawable.one_placeholder)
.into(mIvImg);
int maxWidth = DensityUtil.getWinWidth((Activity) context) - DensityUtil.dip2px(30);
mIvImg.setMaxWidth(maxWidth);
mIvImg.setMinimumWidth(maxWidth);
mIvImg.setMaxHeight(maxWidth * 5);
mIvImg.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Snackbar.make(view.getRootView(), "要保存图片吗", 2000)
.setAction("保存", new View.OnClickListener() {
@Override
public void onClick(View view) {
FileUtil.savePic(context, url);
}
})
.show();
return true;
}
});
}
代码示例来源:origin: NimbleDroid/FriendlyDemo
private void setupThumbnail(int targetWidth, int targetHeight) {
thumbnail.setMaxWidth(targetWidth);
thumbnail.setMaxHeight(targetHeight);
thumbnail.setMinimumWidth(targetWidth);
thumbnail.setMinimumHeight(targetHeight);
thumbnail.requestLayout();
}
代码示例来源:origin: lucid-lynxz/BlogSamples
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.mIVLightBox = new PhotoView(inflater.getContext());
this.mIVLightBox.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
Bitmap bitmap = ((URLDrawableProxy)this.mImageSpan.getDrawable()).getBitmapResource();
Context ctx = inflater.getContext();
int width = MixedUtils.dpToPx(ctx, (float)(bitmap.getWidth() << 1));
int height = MixedUtils.dpToPx(ctx, (float)(bitmap.getHeight() << 1));
BitmapDrawable drawable = new BitmapDrawable(this.getResources(), bitmap);
drawable.setBounds(0, 0, width, height);
int[] size = MixedUtils.getScreenDimention(inflater.getContext());
size = this.resetSize(size, width, height);
this.mIVLightBox.setMinimumWidth(size[0] - MixedUtils.dpToPx(ctx, 16.0F));
this.mIVLightBox.setMinimumHeight(size[1]);
this.mIVLightBox.setImageDrawable(drawable);
return this.mIVLightBox;
}
内容来源于网络,如有侵权,请联系作者删除!