2016-07-09 4 views
0

私は私の視野で円形の公開アニメーションを実行しようとしています。私はもう一方のプロジェクトでこれについていくつかの経験がありますが、今はこのコードを起動できません。円形アニメーションが再生されません

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="match_parent" 
      android:layout_height="0dip" 
      android:layout_weight="1" /> 

     <android.support.v4.app.FragmentTabHost 
      android:id="@android:id/tabhost" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 

    <View 
     android:id="@+id/a_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/app.red" 
     android:visibility="invisible" /> 
</RelativeLayout> 

ログは次のとおりです:

private fun openRevealView() { 

    val animatedView = activity.findViewById(R.id.a_view); 
    animatedView.visibility = View.VISIBLE 

    var cx = (animatedView.getLeft() + animatedView.getRight())/2; 
    var cy = (animatedView.getTop() + animatedView.getBottom())/2; 

    val finalRadius = Math.max(animatedView.height, animatedView.width) 
    val anim = ViewAnimationUtils 
      .createCircularReveal(animatedView, cx, cy, 
        0.toFloat(), 
        finalRadius.toFloat()) 

    Ln.i("Reveal animation params [" 
      + animatedView.height 
      + " " + animatedView.width 
      + ", 0, " + finalRadius + "]") 
    anim.start() 
} 

レイアウトがある

アニメーションのparams [153 114、0、1134]を明らかにし、すべてがよさそうだが、そこアニメーションではなく、単純な見える/見えないアクションです。 またリスナーを追加しようとしたので、うまくいきました。 私は同じようなコードで私の他のプロジェクトをして、それは同じ電話でシャームのように動作します。

私のアンドロイド設定は任意の助けのための "23.0.1"

おかげ

compileSdkVersion 23 buildToolsVersionです。

※コトルンコードです。しかし、それは問題ではない、私は私のプロジェクトの任意の場所からアニメーションを開始することができませんでした。

答えて

0

ですから、回答はとても簡単です。私はfalse insteded

アンドロイド:hardwareAccelerated = "true"

関連する問題