2015-07-01 17 views
5

Pierwsza rzecz jest po pierwsze, to nie jest to samo pytanie jak Create circular reveal for pre-Lollipop devices (Android)Tworzenie Circular Reveal do wstępnego Lollipop Devices

używam biblioteki wspomniano tam stworzyć Circular Reveal, ale nie wydaje się do pracy dla mnie.

XML

<io.codetail.widget.RevealFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <FrameLayout 
      android:id="@+id/circBack" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#ff4081" 
      android:visibility="invisible" 
      ></FrameLayout> 
</io.codetail.widget.RevealFrameLayout> 

JAVA

   View myView = findViewById(R.id.circBack); 


       // get the center for the clipping circle 
       int cx = (myView.getLeft() + myView.getRight())/2; 
       int cy = (myView.getTop() + myView.getBottom())/2; 

       // get the final radius for the clipping circle 
       int finalRadius = Math.max(myView.getWidth(), myView.getHeight()); 


       SupportAnimator animator = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius); 
       animator.setInterpolator(new AccelerateDecelerateInterpolator()); 
       animator.setDuration(1000); 
       myView.setVisibility(View.VISIBLE); 
       animator.start(); 

Okrągła ujawnić nie pojawi. Chodzi mi o to, że nic się nie dzieje, gdy kod zostanie wykonany.

Logcat pokazuje ten

07-01 19:15:47.498 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealRadius> 

07-01 19:15:47.498 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealRadius> 

07-01 19:15:47.498 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealRadius> 

07-01 19:15:47.501 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.ViewAnimationUtils$SimpleAnimationListener> 

07-01 19:15:47.501 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.ViewAnimationUtils$SimpleAnimationListener> 

07-01 19:15:47.502 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedGingerbread> 

07-01 19:15:47.502 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedGingerbread> 

07-01 19:15:47.502 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedIceCreamSandwich> 

07-01 19:15:47.503 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedIceCreamSandwich> 

07-01 19:15:47.503 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedJellyBeanMr2> 

07-01 19:15:47.503 27556-27556/com.ledo.ledoapp I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<io.codetail.animation.RevealAnimator$RevealFinishedJellyBeanMr2> 

Jednak okrągły odsłonić działa, jeśli widok jest ustawiony jako widoczny w plikach XML, ale problem jest, jeśli mogę ustawić widok „circBack” to widoczne w XML pojawia się od momentu uruchomienia aplikacji, co jest normalne.

Jakieś rozwiązanie tego problemu?

Odpowiedz

2

Cóż, może to być problem z uzależnieniem Gradle jak to działało kiedy dodałem biblioteki w ten sposób

Wrong Way

dependencies { 
    compile ('com.github.ozodrukh:CircularReveal:[email protected]') { 
     transitive = true; 
    } 
} 

Right Way

dependencies { 
    compile 'com.github.ozodrukh:CircularReveal:2.0.1' 
} 

Przepraszamy za spóźnioną odpowiedź. Mam nadzieję, że pomaga komuś w potrzebie.

2

Wygląda na to, że uruchamiasz animację w widoku "Odszedłeś"?

Postaraj się, aby visibilty widoku danych, i upewnić się, że go uruchomić wewnątrz

if (mView.getVisibility() == View.VISIBLE) 
{ 
.. 
.. 
    anim.start(); 
} 

bloku kodu.

+0

Miałem widok ustawiony jako "niewidoczny", a nie "nieobecny". –

+0

tak, powiedziałem to jako odniesienie .. ten rodzaj błędu pojawia się, gdy wywołujesz animację na widoku niewidocznym lub nie istniejącym. –