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.

Modifier Padding

Featured Replies

Posté(e)

Bonjour à tous je vous explique mon problème, je souhaiterai avoir 4 petites images en bas de l'ecran. Et lorsque je touch l'ecran j'aimerai qu'elle remonte légerement vers le haut. Les images en question sont des imageView placer dans un LinearLayout. Elles sont de plus animées par une animation-list

<?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/icon" android:duration="500" />
   <item android:drawable="@drawable/joueur" android:duration="500" />
   <item android:drawable="@drawable/joueur_2" android:duration="500" />
</animation-list>

Voici la classe qui gere les 4 petites images :

package com.ThreadTest.Affichage;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;

import com.ThreadTest.main.R;

public class Joueur extends ImageView {

protected AnimationDrawable animation ;
protected Thread currentThread ;
protected int i = 0 ;

public Joueur(Context context, AttributeSet attrs) {
	super(context, attrs);
	Log.e("Joueur", "Constructeur") ;
	// TODO Auto-generated constructor stub
	setBackgroundResource(R.layout.animationjoueur) ;
	animation = (AnimationDrawable) getBackground() ;

}

public void scrollToMiddle(){
	while(i < 10){

		layout(getLeft(), getTop()-1, getRight(), getBottom()-1) ;

		i++ ;
	}
	i = 0 ;
}

@Override
protected void onDraw(Canvas canvas) {
	// TODO Auto-generated method stub
	super.onDraw(canvas);
}

@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
	// TODO Auto-generated method stub
	super.onWindowFocusChanged(hasWindowFocus);
	Log.e("Joueur","onWindowFocusChanged") ;
	animation.start() ;
}

}

Le problème est le suivant l'image en question monte comme prevu mais elle disparait au fur et a mesure.

Peut être que je me trompe complemement de méthode. Comment feriez vous pour scroller une image sur l'écran en touchant au padding (ou autre maniere)?

Merci d'avance,

Cordialement,

Michwii

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.