Get the displayed size of an image inside an ImageView

后端 未结 4 860
时光取名叫无心
时光取名叫无心 2020-12-01 04:47

The code is simple:



        
4条回答
  •  难免孤独
    2020-12-01 05:32

    use

    // For getting imageview height
    imgObj.getMeasuredHeight()
    
    
    // For getting imageview width
    imgObj.getMeasuredWidth();
    
    
    //For getting image height inside ImageView
     imgObj.getDrawable().getIntrinsicHeight();
    
    
    //For getting image width inside ImageView
     imgObj.getDrawable().getIntrinsicWidth();
    

提交回复
热议问题