当前位置: 首页>>代码示例>>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;未经允许,请勿转载。