Android dialog中ソフトキーボード押え入力ボックス

1368 ワード

           dialog  edittext,                       。

          :
(1) dialog   activity   style   android:windowSoftInputMode="adjustPan"

(2)   dialog  style  android:windowSoftInputMode="adjustPan"

                    ,               ,           

      ,        :
(1)      ScrollView , ScrollView             gone,         ,     
 (2)           ,           ,         ,   0         ,   0       

 (3)       ,        ,                   ,      ,       

           :

  view---     

  dialog---  dialog

 et_text---        

//              ,      margin
     et_Text.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener
            @Override
            public void onGlobalLayout() {
                Rect r = new Rect();
                //        
                dialog.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
                //       
                int screenHeight =  dialog.getWindow().getDecorView().getRootView().getHeight();
                //           
                int heightDifference = screenHeight - r.bottom;
                if(heightDifference>0){//     
                   view.setVisibility(View.VISIBLE);
                }else{
                    view.setVisibility(View.GONE);////     
                }
            }
            
        });