monodroid如何在图像上放置图像并放置图像
我正在使用Monodroid创建一个Android应用程序。我遇到了问题,如何将图像放置到其他图像上?此外,位置参数(x,y,高度,重量)将从服务器获取,我想根据这些参数将第2张图像移动到第1张图像上。有没有机会找到这个问题的示例代码?谢谢你的帮助。monodroid如何在图像上放置图像并放置图像
您可以将元素放置在FrameLayout
或RelativeLayout
之内以覆盖元素。
Z-Order由XML文件中的顺序决定,因此第一个元素将在第二个元素后面。例如:
<RelativeLayout>
<ImageView
android:id="@+id/Image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/Man" />
<ImageView
android:id="@+id/Frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/Frame" />
</RelativeLayout>
编辑: 见Android Documentation的信息,如何将RelativeLayout
您可以像这样在布局定义的ImageView:
<ImageView
android:id="@+id/Image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/Icon" />
这将设置图像将被命名图标的可绘制资源。您也可以从C#中使用的SetImageResource方法对其进行设置:
var image = FindViewById<ImageView>(Resource.Id.Image);
image.SetImageResource(Resource.Drawable.Icon);
根据你想拉从那里上ImageView的其他方法,可以帮助,如SetImageURI或SetImageDrawable图像。
感谢您的帮助内的定位元素,但我认为问题不太清楚。我已经把图像放入imageView。我问的是imageView上的imageView。例如,有一个男人的脸,我想在他的脸上画一个框架,这个框架是我的第二个图像。我一直在寻找3天:( – 2013-03-14 10:59:51
谢谢。文档非常有帮助,非常感谢。 – 2013-03-15 14:47:47