2017-04-03 65 views
0

但图像仍处于原始形状。任何解决方案请看代码滑动载入图像到自定义视图不起作用

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); 
       } 
      }); 

回答

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

你需要重写的getSize()函数

相关问题