Je voudrais savoir comment dessiner deux images PNG sur l'écran.Comment dessiner simultanément 2 images PNG sur l'écran
XML Ma mise en page: (nom paperxml.xml)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/paperid"
android:src="@drawable/paperrepresentation"
/>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rockid"
android:src="@drawable/rockrepresentation"
android:layout_alignTop="@id/paperid"
/>
</RelativeLayout>
Quel serait le code Java pour instancier la mise en page XML et afficher à la fois ImageViews sur l'écran en même temps? Il suffit d'appeler setContentView(R.drawable.paperxml);
bloque mon application au démarrage.
Je mets le XML dedans mais il n'en affiche qu'un ImageView Voici une capture d'écran de l'émulateur que j'ai pris. http://i852.photobucket.com/albums/ab87/thomasjakway1/Capture.png Cela vaut la peine de mentionner que le fichier affiché est paperrepresentation – dragonwrenn
C'est à cause de la taille. Essayez de jouer avec 'layout_width' et' layout_height' utilisez quelque chose comme "40dp". Notez également que LinearLayout est défini sur Vertical. – Macarse