How to get the width and height of an android.widget.ImageView?

后端 未结 10 1810
长情又很酷
长情又很酷 2020-11-22 16:53
╔══════════════════════════════════════════════╗   ^
║ ImageView    ╔══════════════╗                ║   |
║              ║              ║                ║   |
║              


        
10条回答
  •  有刺的猬
    2020-11-22 17:25

    The reason the ImageView's dimentions are 0 is because when you are querying them, the view still haven't performed the layout and measure steps. You only told the view how it would "behave" in the layout, but it still didn't calculated where to put each view.

    How do you decide the size to give to the image view? Can't you simply use one of the scaling options natively implemented?

提交回复
热议问题