本文整理匯總了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;
}