J'essaie de prendre une capture d'écran d'une mise en page relative qui consiste en deux images. Un de l'imageview est capable de se déplacer au toucher.Capture d'écran Android d'une mise en page en bitmap
Voilà comment le code ressemble
<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>
Voici le code que j'ai pour créer une image bitmap de la mise en page.
imageLayout.setDrawingCacheEnabled(true);
imageLayout.buildDrawingCache();
Bitmap mergedImage = imageLayout.getDrawingCache();
Le code fonctionne correctement, et il est capable de prendre une capture d'écran des deux images. Cependant, lorsque je déplace imgPhoto, la capture d'écran ne reflète pas la position modifiée. Il montre toujours l'imgPhoto original non importé. Comment puis-je résoudre ce problème? Merci.