當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.setMaxHeight方法代碼示例

本文整理匯總了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();
        }
    });
}
 
開發者ID:mimming,項目名稱:zero-to-app-emojistories,代碼行數:31,代碼來源:StoryAdapter.java

示例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;
}
 
開發者ID:wp521,項目名稱:MyFire,代碼行數:20,代碼來源:MultiImageView.java

示例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;
}
 
開發者ID:MiFirma,項目名稱:mi-firma-android,代碼行數:23,代碼來源:InitiativeAdapter.java


注:本文中的android.widget.ImageView.setMaxHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。