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


Java SimpleDraweeView.setLayoutParams方法代碼示例

本文整理匯總了Java中com.facebook.drawee.view.SimpleDraweeView.setLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleDraweeView.setLayoutParams方法的具體用法?Java SimpleDraweeView.setLayoutParams怎麽用?Java SimpleDraweeView.setLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.drawee.view.SimpleDraweeView的用法示例。


在下文中一共展示了SimpleDraweeView.setLayoutParams方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onDependentViewChanged

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, SimpleDraweeView child, View dependency) {
    maybeInitProperties(child, dependency);

    final int maxScrollDistance = (int) (mStartToolbarPosition - getStatusBarHeight());
    float expandedPercentageFactor = dependency.getY() / maxScrollDistance;

    float distanceYToSubtract = ((mStartYPosition - mFinalYPosition)
            * (1f - expandedPercentageFactor)) + (child.getHeight()/2);

    float distanceXToSubtract = ((mStartXPosition - mFinalXPosition)
            * (1f - expandedPercentageFactor)) + (child.getWidth()/2);

    float heightToSubtract = ((mStartHeight - finalHeight) * (1f - expandedPercentageFactor));

    child.setY(mStartYPosition - distanceYToSubtract);
    child.setX(mStartXPosition - distanceXToSubtract);

    int proportionalAvatarSize = (int) (mAvatarMaxSize * (expandedPercentageFactor));

    CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
    lp.width = (int) (mStartHeight - heightToSubtract);
    lp.height = (int) (mStartHeight - heightToSubtract);
    child.setLayoutParams(lp);
    return true;
}
 
開發者ID:picopalette,項目名稱:event-me,代碼行數:27,代碼來源:ImageBehaviour.java

示例2: changeImageSize

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
/**
 * 改變圖片的尺寸
 *
 * @param imageInfo 獲取的圖片信息
 * @param maxWidth  可顯示的最大寬度
 * @param view      圖片對象
 */
private static void changeImageSize(ImageInfo imageInfo, int maxWidth, SimpleDraweeView view) {
    int height = imageInfo.getHeight();
    int width = imageInfo.getWidth();
    float scaleWidth = (float) maxWidth / width;
    int realHeight = (int) (height * scaleWidth);
    int realWidth = (int) (width * scaleWidth);
    ViewGroup.LayoutParams params = view.getLayoutParams();
    params.height = realHeight;
    params.width = realWidth;
    view.setLayoutParams(params);
}
 
開發者ID:zhonglikui,項目名稱:cardinalsSample,代碼行數:19,代碼來源:FrescoManager.java

示例3: setFresco

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void setFresco(SimpleDraweeView simpleDraweeView, AlbumInfo albumInfo, int width, boolean isGif) {
    if (albumInfo.getWidth() != null && albumInfo.getHeight() != null) {
        if (isGif)
            simpleDraweeView.setImageURI(albumInfo.getPicUrl());
        else
            simpleDraweeView.setImageURI(albumInfo.getGifThumbUrl());
        ViewGroup.LayoutParams l = simpleDraweeView.getLayoutParams();
        l.width = albumInfo.getWidth();
        l.height = albumInfo.getHeight();
        simpleDraweeView.setLayoutParams(l);
    } else
        FrescoUtil.setControllerListener(simpleDraweeView, albumInfo, width, isGif);

}
 
開發者ID:lanyuanxiaoyao,項目名稱:PicKing,代碼行數:15,代碼來源:ContentsAdapter.java

示例4: addSimpleDraweeView

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void addSimpleDraweeView(SimpleDraweeView view, int width, int height) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (params == null) {
        params = new ViewGroup.LayoutParams(width, height);
    }
    params.width = width;
    params.height = height;
    view.setLayoutParams(params);
    contentLayout.addView(view);
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:11,代碼來源:PhotoPostVH.java

示例5: createImageView

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private ImageView createImageView(int position, final boolean isMultiImage) {
	ImageList imageList = imagesList.get(position);
	SimpleDraweeView simpleDraweeView = new SimpleDraweeView(getContext());
	if(isMultiImage){
		simpleDraweeView.setScaleType(ScaleType.CENTER_CROP);
		simpleDraweeView.setLayoutParams(position % MAX_PER_ROW_COUNT == 0 ?moreParaColumnFirst : morePara);
	}else {
		simpleDraweeView.setAdjustViewBounds(true);
		simpleDraweeView.setScaleType(ScaleType.CENTER_INSIDE);
		//imageView.setMaxHeight(pxOneMaxWandH);

           int expectW = imageList.getWidth();
           int expectH = imageList.getHeight();

           if(expectW == 0 || expectH == 0){
			simpleDraweeView.setLayoutParams(onePicPara);
           }else{
               int actualW = 0;
               int actualH = 0;
               float scale = ((float) expectH)/((float) expectW);
               if(expectW > pxOneMaxWandH){
                   actualW = pxOneMaxWandH;
                   actualH = (int)(actualW * scale);
               } else if(expectW < pxMoreWandH){
                   actualW = pxMoreWandH;
                   actualH = (int)(actualW * scale);
               }else{
                   actualW = expectW;
                   actualH = expectH;
               }
			simpleDraweeView.setLayoutParams(new LayoutParams(actualW, actualH));
           }
	}

	simpleDraweeView.setId(imageList.getUrl().hashCode());
	simpleDraweeView.setOnClickListener(new ImageOnClickListener(position));
	simpleDraweeView.setBackgroundResource(R.mipmap.list_default);
	simpleDraweeView.setImageURI(Uri.parse(imageList.getUrl()));

	return simpleDraweeView;
}
 
開發者ID:BaoBaoJianqiang,項目名稱:CustomListView,代碼行數:42,代碼來源:NineImageView.java

示例6: init

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void init(Context context) {
        showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;

        formatBuilder = new StringBuilder();
        formatter = new Formatter(formatBuilder, Locale.getDefault());
        currentWindow = new Timeline.Window();
        componentListener = new ComponentListener();

        LayoutInflater.from(context).inflate(R.layout.item_video_control, this);
        controlLayout = (LinearLayout) findViewById(R.id.video_control_layout);
        time = (TextView) findViewById(R.id.time);
        timeCurrent = (TextView) findViewById(R.id.time_current);
        fullscreen = (ImageView) findViewById(R.id.video_fullscreen);
        fullscreen.setOnClickListener(componentListener);
        progressBar = (SeekBar) findViewById(R.id.video_controller_progress);
        progressBar.setOnSeekBarChangeListener(componentListener);
        progressBar.setMax(PROGRESS_BAR_MAX);

        videoView = new TextureView(context);
        FrameLayout.LayoutParams videoParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        videoView.setLayoutParams(videoParams);
        videoView.setOnClickListener(componentListener);

        thumbnailView = new SimpleDraweeView(context);
        FrameLayout.LayoutParams thumbParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
                .setPlaceholderImage(R.color.loading_color)
                .build();
        thumbnailView.setHierarchy(hierarchy);
        thumbnailView.setLayoutParams(thumbParams);

        loadingBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
        FrameLayout.LayoutParams loadingParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        loadingParams.gravity = Gravity.CENTER;
        loadingBar.setLayoutParams(loadingParams);
        loadingBar.setVisibility(GONE);

        playView = new ImageView(context);
        FrameLayout.LayoutParams playParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        playParams.gravity = Gravity.CENTER;
        playView.setLayoutParams(playParams);
        int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
                context.getResources().getDisplayMetrics());
        playView.setPadding(padding, padding, padding, padding);
        playView.setOnClickListener(componentListener);

//        setOnClickListener(componentListener);
        leftTime = new TextView(context);
        FrameLayout.LayoutParams leftParams = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        leftParams.gravity = Gravity.BOTTOM;
        leftParams.bottomMargin = padding / 2;
        leftParams.leftMargin = padding / 2;
        leftTime.setLayoutParams(leftParams);
        leftTime.setTextColor(Color.WHITE);
        leftTime.setVisibility(GONE);

        addView(videoView, 0);
        addView(thumbnailView, 1);
        addView(loadingBar, 2);
        addView(playView, 3);
        addView(leftTime, 4);
    }
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:68,代碼來源:CommonExoPlayerView.java


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