2015-07-01 12 views
5

primo luogo di prima, questa non è la stessa domanda di Create circular reveal for pre-Lollipop devices (Android)Creare circolare Rivela per la pre-Lollipop Devices

Sto usando la libreria menzionato lì per creare circolare Rivela, ma non sembra funzionare per me cosa.

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(); 

La circolare rivelano non compare. Voglio dire non succede nulla quando il codice viene eseguito.

Logcat mostra questo

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> 

Tuttavia la circolare rivelano non funziona se la vista è impostato su visibile nei file XML, ma il problema è che se ho impostato la vista "circBack" al visibile nell'XML, viene visualizzato dal momento in cui viene lanciata l'app, il che è normale.

Qualche soluzione a questo problema?

risposta

2

Beh, potrebbe essere un problema con la dipendenza Gradle come ha funzionato quando ho aggiunto la biblioteca in questo modo,

Wrong Way

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

modo giusto

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

Ci scusiamo per la risposta in ritardo però. Spero che aiuti qualcuno nel bisogno.

2

Sembra che si sta inizializzando questa animazione sulla vista "Gone"?

Cercare di ottenere visibilità di vista e assicurarsi che lo si esegue all'interno

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

blocco di codice.

+0

Ho avuto la vista impostata su "invisibile" e non "andato". –

+0

sì, l'ho detto solo come riferimento .. questo tipo di errore arriva quando chiami l'animazione su una vista invisibile o persa. –

Problemi correlati