2016-07-19 17 views
2

Ich habe Dialog mit EditText. dieser Dialog hat eingeben und Animation gibt, dieAndroid öffnen Dialogfeld Animation Listener

<style name="LocationDialog" parent="@android:style/Theme.Dialog"> 
     <item name="android:windowAnimationStyle">@style/LocationDialogAnimation</item> 
     <item name="android:windowBackground">@android:color/transparent</item> 
    </style> 

    <style name="LocationDialogAnimation"> 
     <item name="android:windowEnterAnimation">@anim/dialog_location_enter_anim</item> 
     <item name="android:windowExitAnimation">@anim/dialog_location_exit_anim</item> 
    </style> 

i öffnen wollen die Tastatur in style.xml definiert nach der Animation Ursache meiner aktuellen Lösung

locationDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 

Überlappung der Animation und wartet nicht, bis fertig eingeben Die Animation endet zuerst.

ich versuchte auch

locationDialog.setOnShowListener(...); 

Antwort

1

Was Sie können mit Animation in Code möglich sein soll. Sie können den Fokus Ihres EditText zuerst auf android: focusable = "false" in xml oder in code setzen und wenn Ihre Eingabe-Animation beendet ist, können Sie requestFocus auf true setzen.

Animation enter= AnimationUtils.loadAnimation(context,R.anim.enter_anim); 
enter.setAnimationListener(new Animation.AnimationListener() { 
     @Override 
     public void onAnimationStart(Animation animation) { 
     } 

     @Override 
     public void onAnimationEnd(Animation animation) { 
      yourEditText.setFocusable(true); 
      yourEditText.requestFocus(); 
     } 

     @Override 
     public void onAnimationRepeat(Animation animation) { 

     } 
    }); 

Ich hoffe, es wird Ihnen helfen.