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.

Image clignotante : casse tête!

Featured Replies

Posté(e)

Hello,

Je souhaite faire une chose assez simple à priori : faire clignoter une image!

Je retourne le problème depuis plusieurs heure mais je n'arrive à rien de concluant !

Voici mon code :

package monandroid.packageandroid;

import android.app.Activity;

import android.os.Bundle;

import android.view.animation.Animation;

import android.view.animation.AnimationUtils;

import android.widget.ImageView;

public class MonActivite extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

try {

RunAnimations();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

private void RunAnimations() throws InterruptedException {

Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.fadein);

fadeIn.reset();

Animation fadeOut = AnimationUtils.loadAnimation(this, R.anim.fadeout);

fadeOut.reset();

ImageView iv = (ImageView) findViewById(R.id.imageView2);

iv.clearAnimation();

iv.startAnimation(fadeIn);

iv.startAnimation(fadeOut);

}

}

Mes animations (res/anim)

<?xml version="1.0" encoding="UTF-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<alpha android:fromAlpha="0.0"

android:toAlpha="1.0"

android:startOffset="0"

android:interpolator="@android:anim/accelerate_interpolator"

android:duration="3000"

android:repeatCount="infinite"

/>

</set>

<?xml version="1.0" encoding="UTF-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<alpha android:fromAlpha="1.0"

android:startOffset="3000"

android:toAlpha="0.0"

android:interpolator="@android:anim/accelerate_interpolator"

android:duration="3000"

android:repeatCount="infinite"

/>

</set>

Merci d'avance pour votre aide!!

  • 2 weeks later...
Posté(e)

Salut,

au lieu de faire une animation, tu peut créer une image qui change selon tes besoins.

dans drawable tu place un fichier anim.xml

<?xml version="1.0" encoding="UTF-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/image1" android:duration="[duree image]" />
<item android:drawable="@drawable/image2" android:duration="[duree image]" />
...
<item android:drawable="@drawable/imagen" android:duration="[duree image]" />
</animation-list>

puis tu met toutes tes images imagex dans drawable et cela aura l'air d'une animation (comme un gif).

Voila en espérant t'avoir un peu aidé

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

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.