本文整理了Java中android.widget.ImageView.setMaxHeight()
方法的一些代码示例,展示了ImageView.setMaxHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.setMaxHeight()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:setMaxHeight
暂无
代码示例来源:origin: mikepenz/FastAdapter
public ViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
this.view = view;
//optimization to preset the correct height for our device
int columns = view.getContext().getResources().getInteger(R.integer.wall_splash_columns);
int screenWidth = view.getContext().getResources().getDisplayMetrics().widthPixels;
int finalHeight = (int) (screenWidth / 1.5);
imageView.setMinimumHeight(finalHeight / columns);
imageView.setMaxHeight(finalHeight / columns);
imageView.setAdjustViewBounds(false);
//set height as layoutParameter too
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) imageView.getLayoutParams();
lp.height = finalHeight / columns;
imageView.setLayoutParams(lp);
}
}
代码示例来源:origin: mikepenz/FastAdapter
public ViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
this.view = (FrameLayout) view;
//optimization to preset the correct height for our device
int screenWidth = view.getContext().getResources().getDisplayMetrics().widthPixels;
int finalHeight = (int) (screenWidth / 1.5) / 2;
imageView.setMinimumHeight(finalHeight);
imageView.setMaxHeight(finalHeight);
imageView.setAdjustViewBounds(false);
//set height as layoutParameter too
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) imageView.getLayoutParams();
lp.height = finalHeight;
imageView.setLayoutParams(lp);
}
}
代码示例来源:origin: Flipboard/bottomsheet
thumb.setMinimumWidth(thumbnailSize);
thumb.setMinimumHeight(thumbnailSize);
thumb.setMaxHeight(thumbnailSize);
thumb.setMaxWidth(thumbnailSize);
if (tile.imageUri != null) {
代码示例来源:origin: jaydenxiao2016/AndroidFire
private ImageView createImageView(int position, final boolean isMultiImage) {
String url = imagesList.get(position);
ImageView imageView = new ColorFilterImageView(getContext());
if(isMultiImage){
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setLayoutParams(position % MAX_PER_ROW_COUNT == 0 ?moreParaColumnFirst : morePara);
}else {
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setMaxHeight(pxOneMaxWandH);
imageView.setLayoutParams(onePicPara);
}
imageView.setTag(R.string.zone_img_position,position);
imageView.setId(url.hashCode());
imageView.setOnClickListener(mImageViewOnClickListener);
ImageLoaderUtils.display(getContext(), imageView, ImageUtil.getImageUrl(url));
return imageView;
}
代码示例来源:origin: stackoverflow.com
channelIcon.setMaxHeight(30);
channelIcon.setMaxWidth(30);
channelIcon.setImageDrawable(o.getLogo());
代码示例来源:origin: ankidroid/Anki-Android
mImagePreview.setAdjustViewBounds(true);
mImagePreview.setMaxHeight((int) Math.round(height * 0.4));
mImagePreview.setMaxWidth((int) Math.round(width * 0.6));
代码示例来源:origin: stackoverflow.com
ImageView imageView=new ImageView(context);
imageView.setAdjustViewBounds(true);
imageView.setImageBitmap(bitmap);
imageView.setMaxHeight(maxHeight);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
layout.addView(imageView);
代码示例来源:origin: stackoverflow.com
LinearLayout layout = (LinearLayout)findViewById(R.id.imageLayout);
for(int i=0;i<10;i++)
{
ImageView image = new ImageView(this);
image.setLayoutParams(new android.view.ViewGroup.LayoutParams(80,60));
image.setMaxHeight(20);
image.setMaxWidth(20);
// Adds the view to the layout
layout.addView(image);
}
代码示例来源:origin: stackoverflow.com
LinearLayout layout = (LinearLayout)findViewById(R.id.imageLayout);
for(int i=0;i<5;i++)
{
ImageView image = new ImageView(this);
image.setLayoutParams(new android.view.ViewGroup.LayoutParams(80,60));
image.setMaxHeight(10);
image.setMaxWidth(10);
// Adds the view to the Linerlayout
layout.addView(image);
}
代码示例来源:origin: stackoverflow.com
ImageView imgView = new ImageView(activityContext);
LinearLayout.LayoutParams vp = new LinearLayout.LayoutParams
(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
imgView.setLayoutParams(vp);
imgView.setMaxHeight(100);
imgView.setMaxWidth(100);
imgView.setImageURI(Uri.parse(captureImg.toString()));
mainFrame.addView(imgView);
代码示例来源:origin: stackoverflow.com
ImageView image = new ImageView(this);
LinearLayout.LayoutParams vp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
image.setLayoutParams(vp);
image.setMaxHeight(50);
image.setMaxWidth(50);
// other image settings
image.setImageDrawable(drawable);
theLayout.addView(image);
代码示例来源:origin: stackoverflow.com
ImageView image = new ImageView(this);
LinearLayout.LayoutParams vp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
image.setLayoutParams(vp);
image.setMaxHeight(50);
image.setMaxWidth(50);
// other image settings
image.setImageDrawable(drawable);
theLayout.addView(image);
代码示例来源:origin: stackoverflow.com
ImageView img1=(ImageView) findViewById(R.id.imageview);
img1.setMaxHeight(100);
img1.setMaxWidth(100);
代码示例来源:origin: stackoverflow.com
ViewGroup layout=new LinearLayout(context);
TextView tv=new TextView(context); //your text
tv.setText("my text");
ImageView imageView=new ImageView(context); //your icon
//filling image view with icon bitmap (in this case from resource)
imageView.setImageBitmap(BitmapFactory.decodeStream(context.getResources().openRawResource(resourceId)));
//ensuring that icon size will be more or less like text height
imageView.setAdjustViewBounds(true);
imageView.setMaxHeight((int )(tv.getLineHeight()*1.5));
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
layout.addView(imageView); //adding icon
tv.setGravity(Gravity.BOTTOM|Gravity.LEFT);
layout.addView(tv); //adding text
代码示例来源:origin: stackoverflow.com
final ImageView imageView = new ImageView(context);
final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(150, 200);
params.weight = 1;
imageView.setLayoutParams(params);
imageView.setMaxHeight(200);
imageView.setMaxWidth(150);
new DownloadImageTask(imageView, layout).execute(tempValues.getItemAbsolutePath());
代码示例来源:origin: stackoverflow.com
ImageView imageView = (ImageView) findViewById(R.id.imageView);
imageView.setAdjustViewBounds(true);
imageView.setMaxHeight(imageView.getHeight());
imageView.setMaxWidth(imageView.getWidth());
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
代码示例来源:origin: mikepenz/ItemAnimators
public ViewHolder(View view) {
super(view);
ButterKnife.bind(this, view);
this.view = (FrameLayout) view;
//optimization to preset the correct height for our device
int screenWidth = view.getContext().getResources().getDisplayMetrics().widthPixels;
int finalHeight = (int) (screenWidth / 1.5) / 2;
imageView.setMinimumHeight(finalHeight);
imageView.setMaxHeight(finalHeight);
imageView.setAdjustViewBounds(false);
//set height as layoutParameter too
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) imageView.getLayoutParams();
lp.height = finalHeight;
imageView.setLayoutParams(lp);
}
}
代码示例来源:origin: stackoverflow.com
public class MyClass {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Do your other stuff here
MenuItem item = menu.getItem(0);
if (item.getItemId() == R.id.action_example) {
ImageView imageView = new ImageView(getActivity());
imageView.setMaxHeight(18);
imageView.setMaxWidth(18);
imageView.setImageResource(R.drawable.barchart32);
item.setActionView(imageView);
}
}
}
代码示例来源:origin: yaozs/YzsLib
private ImageView createImageView(int position, final boolean isMultiImage) {
String url = imagesList.get(position);
ImageView imageView = new ColorFilterImageView(getContext());
if(isMultiImage){
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setLayoutParams(position % MAX_PER_ROW_COUNT == 0 ?moreParaColumnFirst : morePara);
}else {
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ScaleType.CENTER_INSIDE);
imageView.setMaxHeight(pxOneMaxWandH);
imageView.setLayoutParams(onePicPara);
}
imageView.setId(url.hashCode());
imageView.setOnClickListener(new ImageOnClickListener(position));
Glide.with(getContext()).load(url).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
return imageView;
}
代码示例来源:origin: NimbleDroid/FriendlyDemo
private void setupThumbnail(int targetWidth, int targetHeight) {
thumbnail.setMaxWidth(targetWidth);
thumbnail.setMaxHeight(targetHeight);
thumbnail.setMinimumWidth(targetWidth);
thumbnail.setMinimumHeight(targetHeight);
thumbnail.requestLayout();
}
内容来源于网络,如有侵权,请联系作者删除!