【发布时间】:2015-02-14 15:35:48
【问题描述】:
给定一个像这样的简单 RelativeLayout:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#0fffff">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/img001" />
</RelativeLayout>
布局边框和图像边框之间的左/上间距取决于在 imageView 中加载的图像的宽高比。
在此布局中显示图像后,我如何(以编程方式)知道实际边距(青色区域的宽度和高度)?
【问题讨论】:
标签: android android-layout imageview margins