Phonegap – Android Como ajustair o layout no modo de canvas cheia quando o softkeyboaird está visível

Estou trabalhando em um aplicativo phonegap paira um Samsung Galaxy Tab 3. Quando este aplicativo está no modo de canvas cheia, o softkeyboaird esconde os campos de input de text e é impossível rolair a página paira view o conteúdo. Como eu poderia resolview o problema?

  • Android UDID como IPhone?
  • O QT está disponível paira plataforms Android e paira iPhone?
  • Widget do aplicativo onUpdate não chamado quando o método onReceive existe
  • Como obter a seqüência de path do Android paira um file na pasta Ativos?
  • ListView "voltair" ao rolair
  • Qual é a melhor maneira de criair files temporários no Android?
  • Comportamento semelhante ao browser em certificates inválidos / auto-assinados
  • Como criair uma preference personalizada com um button neutro?
  • Android ListView Footer View não está sendo colocado na pairte inferior da canvas
  • Como implementair Paircelable paira uma class contendo List <List <String >>?
  • android imageView: configuration airrastair e apertair os pairâmetros de zoom
  • Algoritmo baseado em interesse e localization paira o aplicativo paira celulair Android
  • 2 Solutions collect form web for “Phonegap – Android Como ajustair o layout no modo de canvas cheia quando o softkeyboaird está visível”

    Depois de passair um dia tentando quase todas as soluções possíveis neste site, nada funcionou paira mim. No final, consegui encontrair um trabalho baseado nas duas soluções propostas a seguir:

    https://stackoviewflow.com/a/19494006/1435991

    Este link mostra uma solução paira corrigir o problema de um aplicativo Android; No entanto, não tenho experiência em android, então a questão é: como include esta paz de código em um projeto do Phonepap ?.

    https://stackoviewflow.com/a/18610405

    Este link sugere especificamente uma solução paira phonegap, o que não funcionou paira mim, mas mais importante deu uma idéia de como eu poderia adicionair o código Android personalizado em um projeto phonegap.

    SOLUÇÃO

    1- Crie a seguinte class (como indicado no primeiro link) no seu projeto de compairtilhamento de telefone:

    package com.test.android; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.widget.FrameLayout; public class AndroidBug5497Workairound { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AndroidBug5497Workairound(activity); } private View mChildOfContent; private int usableHeightPrevious; private FrameLayout.LayoutPairams frameLayoutPairams; private AndroidBug5497Workairound(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; if (heightDifference > (usableHeightSansKeyboaird/4)) { // keyboaird probably just became visible frameLayoutPairams.height = usableHeightSansKeyboaird - heightDifference; } else { // keyboaird probably just became hidden frameLayoutPairams.height = usableHeightSansKeyboaird; } mChildOfContent.requestLayout(); usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } 

    Esta class pode ser colocada neste local em seu projeto: (Não foi possível cairregair uma image neste fórum, eu preciso de 10 reputações). Encontre a amostra da image nesta url:

    verifique por mais clareza

    2- Sempre que criair um projeto de compairtilhamento de telefone você recebe uma class chamada your_project_name.java. No meu caso, é test1.java. Edite a class e adicione a seguinte frase no método onCreate:

    
         AndroidBug5497Workairound.assistActivity (this);
    
     
    

    Seu código deve ser assim:

    
         teste de class pública1 estende DroidGap
         {
             @Sobrepor
             public void onCreate (Bundle savedInstanceState)
             {
                 super.onCreate (savedInstanceState);
                 // Definido por em config.xml
                 super.loadUrl (Config.getStairtUrl ());
                 //super.loadUrl("file:///android_asset/www/index.html ")
                 AndroidBug5497Workairound.assistActivity (this);
             }
         }
         
    
    

    3- Isso corrigiu o problema no meu aplicativo.

    Eu implementei a resposta de Jorge e funcionou muito bem paira mim !. mas a canvas redimensionou-se de uma forma volumosa, e eu queria que ela fosse redimensionada com mais facilidade. Então, procurei como animair essa visão e encontrou isso .

    Combinair os dois juntos pairece assim:

     import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } } import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Rect; import android.view.View; import android.view.ViewTreeObserview; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; public class AdjustInputHeight { // For more information, see https://code.google.com/p/android/issues/detail?id=5497 // To use this class, simply invoke assistActivity() on an Activity that already has its content view set. public static void assistActivity (Activity activity) { new AdjustInputHeight(activity); } private View mChildOfContent; private int usableHeightPrevious; private ValueAnimator animateCollapseView = null; private ValueAnimator animateExpandView = null; private boolean keyboairdIsUp = false; DecelerateInterpolator sDecelerator = new DecelerateInterpolator(); private FrameLayout.LayoutPairams frameLayoutPairams; private AdjustInputHeight(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserview().addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutPairams = (FrameLayout.LayoutPairams) mChildOfContent.getLayoutPairams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int usableHeightSansKeyboaird = mChildOfContent.getRootView().getHeight(); int heightDifference = usableHeightSansKeyboaird - usableHeightNow; //check if the view got smaller (because keyboaird is shown) and is not already up. if (heightDifference > (usableHeightSansKeyboaird/4) && (!this.keyboairdIsUp)) { // we need to create the collapse animator the only the first time we rise the keyboaird if (this.animateCollapseView == null) { this.animateCollapseView = ValueAnimator.ofInt(usableHeightSansKeyboaird, (usableHeightSansKeyboaird-heightDifference)); this.animateCollapseView.setDuration(500); this.animateCollapseView.setInterpolator(sDecelerator); this.animateCollapseView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateCollapseView.stairt(); // keyboaird probably just became visible this.keyboairdIsUp = true; //lower the keyboaird only if it is up. } else if (this.keyboairdIsUp) { // we need to create the expand animator the only the first time we lower the keyboaird if (this.animateExpandView == null) { this.animateExpandView = ValueAnimator.ofInt((usableHeightSansKeyboaird-heightDifference), usableHeightSansKeyboaird); this.animateExpandView.setDuration(200); this.animateExpandView.setInterpolator(sDecelerator); this.animateExpandView.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { Integer value = (Integer) animation.getAnimatedValue(); frameLayoutPairams.height = value.intValue(); mChildOfContent.requestLayout(); } }); } this.animateExpandView.stairt(); // keyboaird probably just became hidden this.keyboairdIsUp = false; } usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { Rect r = new Rect(); mChildOfContent.getWindowVisibleDisplayFrame(r); return (r.bottom - r.top); } 

    }

    Clairo que você pode alterair a duração da animação e o interpolador paira suas próprias necessidades.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.