Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

swap de fond d'écran

Featured Replies

Posté(e)

hello

il y a quelques temps, j'avais commencé un travail et il me fallait dessiner sur une image, après quelques recherches, j'en suis arrivé à ce bout de code

        affichage = (ImageView)findViewById(fond);  // fond = R.id.fondécran1 ou 2
        affichage.buildDrawingCache();
        imageFond = affichage.getDrawingCache();
        canvas = new Canvas(imageFond);
        paint = new Paint();
        matrix = new Matrix();
        canvas.drawBitmap(imageFond,matrix, paint);
        affichage.setImageBitmap(imageFond);
        affichage.setOnTouchListener(this);

Je souhaîte changer de temps en temps de fond d'écran (alterner R.id.fondécran1 et 2), pour cela je change la visibilité des fonds d'écran (via par exemple (ImageView)findViewById(R.id.fondécran1).setVisibility(View.INVISIBLE ou VISIBLE);) avant de lancer ce bout de code.

Seulement ça marche 1fois pas 2: j'obtiens un écran noir

 

ma question: est-ce que ce bout de code est foireux? Est-ce qu'il y a une histoire de cache à vider? La méthode INVISIBLE/VISIBLE est-elle foireuse?

Posté(e)
  • Auteur

bon, j'ai trouvé une parade, apparemment, le problème vient de

affichage = (ImageView)findViewById(fond);  
affichage.buildDrawingCache();
imageFond = affichage.getDrawingCache();

on ne peut semble-t-i pas le faire plusieurs fois en changeant 'fond'. alors du coup j'ai 2variables 'affichage' (pour mes 2fonds d'écran) que je charge 1seule fois au début et ensuite je lanceplus tard le reste du out de code pour changer le fond d'écran. En gros il faut autant de variable 'affichage' que de fond d'écran. Le 'drawingcache' ne  doit pas être dynamique pour une seule variable mais pour plusieurs

Modifié par moijdik

Rejoignez la conversation

Vous pouvez poster maintenant et vous enregistrez plus tard. Si vous avez un compte, connectez-vous maintenant pour poster.

Invité
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Répondre à ce sujet…

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.