Android getMeasuredHeight returns wrong values !

后端 未结 7 676
野的像风
野的像风 2020-12-02 20:13

I\'m trying to determine the real dimension in pixels of some UI elements !

Those elements are inflated from a .xml file and are initialized with dip width and height

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 20:37

    Probably, because of what you have in AndroidManifest.xml (link) file and from which drawable-XXX directory the xml file comes, Android loads resources with scaling operation. You decide to use "dip" (link) dimension unit which is virtual and the real value (px) can be different.

提交回复
热议问题