Salut, quelqu'un saurait pourquoi cette anim ne se lance pas ?:
res/anim/ma_premiere_anim.xml:
MainActivity:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:fromXScale="1.0" android:fromYScale="1.0" android:toXScale="2.0" android:toYScale="0.5" android:pivotX="50%" android:pivotY="50%" android:duration="300"/> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:startOffset="300" android:duration="2000"/> </set>
layout activity_main:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView hello; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); hello = (TextView) findViewById(R.id.hello); Animation animation = AnimationUtils.loadAnimation(this, R.anim.ma_premiere_anim); hello.startAnimation(animation); } }
J'ai beau comprendre chaque ligne de ce que j'ai codé je ne comprends pas pourquoi l'anim ne se lance pas.. Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <TextView android:id="@+id/hello" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /> </android.support.constraint.ConstraintLayout>![]()
Partager