滑动加载图像到自定义视图不起作用

时间:2017-04-03 08:13:01

标签: android-custom-view android-glide

但是图像仍处于原始状态。有解决方案吗请查看代码

CircularView circularimage1= (CircularView)findViewById(R.id.customView);
Glide.with(this.getApplicationContext()).load(R.drawable.picture1)
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(new ViewTarget<CircularImageView, GlideDrawable>(circularimage1) {
                @Override
                public void onResourceReady(GlideDrawable resource, GlideAnimation anim) {
                    CircularView myView = this.view;
                    // Set your resource on myView and/or start your animation here.
                    Log.e(TAG, "onResourceReady: "+myView.getBorderWidth() );
                    myView.setImageDrawable(resource.getCurrent());
                    myView.setBorderWidth(2);
                    Log.e(TAG, "onResourceReady: "+myView.getBorderWidth() );
                    myView.setBorderColor(R.color.yellow);
                }
            });

1 个答案:

答案 0 :(得分:0)

 @Override
        public void getSize(SizeReadyCallback cb) {
            //You can pass whatever width/height value you want using  the following function
            cb.onSizeReady(....)
        }

您需要覆盖getSize()函数