在Android中覆盖图像

时间:2011-07-27 10:40:32

标签: android android-canvas

我有一个应用程序,其中我使用TouchImageView包含图像,并使用捏缩放,平移等实现缩放。它工作正常。现在我需要在TouchImageView图像上包含某种图像或作为叠加层写入的文本。

我尝试使用画布绘制,但是它是在背景上绘制的,而不是TouchImageView。那么我该如何实现它,以便图像上有一个指针或叠加,它可以被缩放,平移等。

任何帮助将不胜感激。

编辑 - 我正在附加我的XML

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/rel"
><com.reva.restauranthome.Panel android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/panelView">

</com.reva.restauranthome.Panel>

<ZoomControls android:id="@+id/zoomControls1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"></ZoomControls></RelativeLayout>

在我的代码中,我以这种方式使用它!

Panel v =(Panel)findViewById(R.id.panelView);
          v.bringToFront();

干杯,

尼西

1 个答案:

答案 0 :(得分:0)

我会使用relativelayout并让叠加视图始终位于顶部。

overlayView.bringToFront(); 

将把它带到前面。