本文整理汇总了Java中android.widget.ImageView.setMaxHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setMaxHeight方法的具体用法?Java ImageView.setMaxHeight怎么用?Java ImageView.setMaxHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setMaxHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addImage
import android.widget.ImageView; //导入方法依赖的package包/类
public void addImage(StorageReference storageRef, String filePath, String storyId) {
storyId += "-photo";
removeStuffWithThisKey(storyId);
final ImageView imageThing = new ImageView(myContext);
int gridThingPixels = (int) myContext.getResources().getDimension(R.dimen.grid_thing);
imageThing.setMaxHeight(gridThingPixels);
imageThing.setMaxWidth(gridThingPixels);
gridContents.add(new TaggedView(imageThing, storyId));
this.notifyDataSetChanged();
// and a photo (up to 10mb)
Task<byte[]> imageDownloadTask = storageRef.child(filePath).getBytes(100 * 1024 * 1024);
imageDownloadTask.addOnCompleteListener(new OnCompleteListener<byte[]>() {
@Override
public void onComplete(@NonNull Task<byte[]> task) {
byte[] imageBytes = task.getResult();
Bitmap imageBitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
imageThing.setImageBitmap(imageBitmap);
StoryAdapter.this.notifyDataSetChanged();
}
});
}
示例2: createImageView
import android.widget.ImageView; //导入方法依赖的package包/类
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;
}
示例3: getView
import android.widget.ImageView; //导入方法依赖的package包/类
public View getView(int position, View convertView,
ViewGroup parent) {
if(convertView==null){
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(R.layout.fragment_initiative_item, parent, false);
}
// Obtenemos el elemento.
Initiative objectItem = initiativeList.get(position);
// Componemos la vista con los datos del elemento.
TextView titleTextViewItem = (TextView) convertView.findViewById(R.id.initiative_title);
byte[] byteArray = objectItem.getBanner();
ImageView imageView = (ImageView) convertView.findViewById(R.id.initiative_image);
Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
imageView.setImageBitmap(bmp);
imageView.setMaxHeight(5);
titleTextViewItem.setText(objectItem.getTitle());
return convertView;
}