【发布时间】:2017-09-17 14:17:11
【问题描述】:
我正在尝试截取由两个图像视图组成的相对布局的屏幕截图。 imageview 之一可以在触摸时移动。
下面是代码的样子
<RelativeLayout
android:id="@+id/imageLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgPhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
/>
<ImageView
android:id="@+id/imgBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
以下是我用于创建布局位图的代码。
imageLayout.setDrawingCacheEnabled(true);
imageLayout.buildDrawingCache();
Bitmap mergedImage = imageLayout.getDrawingCache();
代码运行良好,它能够截取两张图像的屏幕截图。但是,当我移动 imgPhoto 时,屏幕截图不会反映更改的位置。它仍然显示原始未移动的 imgPhoto。我该如何解决?谢谢。
【问题讨论】:
标签: android performance android-layout android-imageview android-bitmap