我正在使用相对布局将一个较小的图像叠加在较大的图像之上。
我希望较小图像的右下角与较大图像的 B-R 角重合。我在布局 XML 中使用边距参数(指定倾斜测量),但这似乎不适用于所有设备和分辨率 - 在某些情况下,小图像会从边框移动 4-5 像素。
是否可以指定没有像素值的较小图像的位置? IE。与重力或其他什么?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/big_image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/bigimage"/>
<ImageView
android:id="@+id/little_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_alignRight="@id/big_image"
android:layout_alignBottom="@id/big_image"
android:src="@drawable/littleimage"/>
</RelativeLayout>
不错的事情RelativeLayout
你可以使用relative位置和尺寸,而不是使用特定的倾斜或像素。在上面的例子中,我只是玩了android:layout_align*
参数,以确保两个图像对齐。请记住,我设置了小图像的特定尺寸,但您可以更改它以满足您的需要。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)