2012-09-17 2 views
1

Je souhaite avoir un bouton invisible à l'origine. Je veux ensuite le bouton pour se fondre dans vueBouton Android qui apparaît dans la vue

Voici mon code

<Button 
    android:id="@+id/textFade" 
    android:layout_width="fill_parent" 
    android:layout_height="60dp" 
    android:alpha="0" 
    android:text="Sample Button" /> 

puis dans la fonction onCreate de mon activité i ajouter

Animation fadeIn = new AlphaAnimation(0, 1); 
    fadeIn.setInterpolator(new AccelerateInterpolator()); //add this 
    fadeIn.setDuration(1000); 

    Button b=(Button)findViewById(R.id.textFade); 


    AnimationSet animation = new AnimationSet(false); //change to false 
    animation.addAnimation(fadeIn); 
    b.setAnimation(animation); 

Mais cela ne fonctionne pas. Des idées comment je peux y parvenir?

Cordialement

Répondre

Questions connexes