2017-04-03 78 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()函數