Comment faire pour résoudre le problème de résolution

je met les balles dans leurs place et si je teste avec compagnon Ai les balles ce délacent

sinon est ce que je peux dessiner une forme cliquable sur limage de cadre comme l'outils polygone ou lasso

Hello kamri

I'm sorry but I do not understand what you are trying to say. Perhaps you can give more detail by listing what happens compared to what you expect to happen?

Very nice graphics by the way.

1 Like

Please check your spelling else we are not able to translate correctly. ...


1 Like

je veux créer une application appinventor
j'ais utiliser une image du fond de cadre
je veux si je clique sur la balle qui devrais être situe sur un animal le label affiche son non
mais lorsque je teste avec le compagnon les balles change de place peut être a cause de résolution entre appinventor et mon smartphone
aide svp

Ah, now I understand :thinking:

The App Inventor Designer only roughly represents the Smartphone Screen:

  1. Usually, the screen resolution of a Smartphone is much greater than a desktop PC or Laptop.
  2. Smartphones are all shapes, sizes and resolutions.

So, you can place sprites initially in the App Inventor Designer Window, but with some phones those positions could be a long way out.

We can tackle this design problem in two ways (note, I'm not talking about the 6 Nations rugby :grin:):

  1. We can set the size of the canvas in pixels - however for "one size fits all phones" the canvas has to be relatively small. If that's OK for your App, job done.

  2. A different approach is to allow the Canvas to be sized in percentages %. This means it will be a different size on different phones but it will be a good size on most.

  • but how then do we know where the sprites should be placed? At run-time, we need to verify the actual size (in pixels or dp) of the canvas and then via code Blocks, we can place the sprites accurately. My fellow Power User Anke has made an extension that serves this purpose perfectly:

merci bien [ChrisWard] pour votre aide
svp si vous pouvez m'expliquer comment utiliser cette extension avec en exemple d'utilisation

Measure the proportional displacement of each Ball's center from the top and left sides of your background picture, and apply those proportions to the Canvas's Height and Width to get the desired x,y pixels for each ball's center.

Hi Kamri

Have you downloaded the extension? Here is an example verifying the Canvas size in DP and mm. I have included millimetres as you can actually put a rule on the screen of your phone and confirm the values!

Once you know the size of the Canvas (= size of your image) you can calculate the sprite positions.

1 Like

Just had a thought - if the Canvas is sized in %, you could position the sprites in % too, without requiring the extension.

1 Like