宽度我写了下面的xml:安卓:关于此微的RelativeLayout的
<RelativeLayout>
<LinearLayout>
......//widgets
</LinearLayout>
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pic"
/>
</RelativeLayout>
而在代码中,我想要得到的IMG的宽度。但总是得到。 为什么? 在此先感谢! PS:对不起,我忘了添加android:src="..."
;但它仍然是0!
如何获取图像宽度 –