###viewにアニメーションが適応できない。
タイトル通りです。
私は下の画像のように、二つのテキストビューをグループ化し、それを
final View splash_group=findViewById(R.id.splash_group);
で取得しました。
しかし、いざそれにアニメーションを適応しようとしてもできませんでした。(ちなみに一つのテキストビューでの適応は成功しています)
これはなぜなのでしょうか?
変数の型がViewGroupじゃないのが原因かとも思いましたが、android.support.constraint.Group
はViewGroup
を継承していないと、聞いたのでどうしようもありません。
下にコードを記します。
『constraintにおける複数ビューにアニメーションを適応する方法』
どうか教授お願いします。
java
1protected void onCreate(Bundle savedInstanceState) { 2 super.onCreate(savedInstanceState); 3 setContentView(R.layout.activity_splash); 4 5 //一つのテキストビューの場合 6 //final TextView splash_text=findViewById(R.id.splash_text); 7 final View splash_group=findViewById(R.id.splash_group); 8 9 final Animation fadeout=AnimationUtils.loadAnimation(this,R.anim.fade_out); 10 11 new Handler().postDelayed(new Runnable() { 12 @Override 13 public void run() { 14 //できない 15 splash_group.startAnimation(fadeout); 16 //下のように一つの場合できる 17 //splash_text.startAnimation(fadeout); 18 19 } 20 }, 4000); 21 22 }
回答1件
あなたの回答
tips
プレビュー