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


Java SimpleDraweeView.setHierarchy方法代碼示例

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


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

示例1: displayImage

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void displayImage(SimpleDraweeView draweeView, String url) {
    GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    //設置占位圖
    if (hierarchy == null) {
        hierarchy = GenericDraweeHierarchyBuilder.newInstance(getResources())
                .setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                        , ScalingUtils.ScaleType.CENTER).build();
        draweeView.setHierarchy(hierarchy);
    } else {
        hierarchy.setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                , ScalingUtils.ScaleType.CENTER);
    }

    //構建ImageRequestBuilder,傳入請求Uri
    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url));
    //構建Controller
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeView.getController())
            .setImageRequest(requestBuilder.build())
            .build();
    //設置圖片,Fresco設置顯示圖片都是通過Controller來實現
    draweeView.setController(controller);
}
 
開發者ID:idisfkj,項目名稱:Zoomable,代碼行數:24,代碼來源:MainActivity.java

示例2: createSimpleDraweeView

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private SimpleDraweeView createSimpleDraweeView() {
    SimpleDraweeView view = new SimpleDraweeView(itemView.getContext());
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(itemView.getContext().getResources());
    GenericDraweeHierarchy hierarchy = builder
            .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
            .setPlaceholderImage(R.color.loading_color)
            .setPlaceholderImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
            .setFailureImage(R.mipmap.ic_failed)
            .setFailureImageScaleType(ScalingUtils.ScaleType.CENTER)
            .build();
    view.setHierarchy(hierarchy);
    view.setTag(atomicInteger.getAndIncrement());
    view.setOnClickListener(this);
    return view;
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:17,代碼來源:PhotoPostVH.java

示例3: loadHeadView

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
public static void loadHeadView(Context context, SimpleDraweeView simpleDraweeView, Uri httpUri) {
    //初始化圓角圓形參數對象
    RoundingParams rp = new RoundingParams();
    //設置圖像是否為圓形
    rp.setRoundAsCircle(true);

    final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(context.getResources())
            .setRoundingParams(rp)
            .build();

    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setUri(httpUri)
            .setTapToRetryEnabled(true)
            .setOldController(simpleDraweeView.getController())
            .build();
    simpleDraweeView.setHierarchy(hierarchy);
    simpleDraweeView.setController(controller);
}
 
開發者ID:lennyup,項目名稱:react-native-udesk,代碼行數:19,代碼來源:UdeskUtil.java

示例4: frescoViewSetScaleType

import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void frescoViewSetScaleType(Context context, SimpleDraweeView mFrescoView){
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(context.getResources());
    GenericDraweeHierarchy hierarchy = builder.build();
    mFrescoView.setHierarchy(hierarchy);
    switch (mScaleType) {
        case FIT_XY:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_XY);
            break;
        case FIT_START:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_START);
            break;
        case FIT_CENTER:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
            break;
        case FIT_END:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_END);
            break;
        case CENTER:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER);
            break;
        case CENTER_CROP:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
            break;
        case CENTER_INSIDE:
            hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE);
            break;
    }
}
 
開發者ID:ryanlijianchang,項目名稱:AdPlayBanner,代碼行數:30,代碼來源:ImageLoaderManager.java

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