2016-10-11 4 views
2

У меня есть фрагмент диалога в моем приложении с autocompletetextview, но выпадающий список вместо выравнивания с верхней частью мягкой клавиатуры помещается сзади, не предоставляя доступ к некоторым из предметы.Выпадающее меню Autocompletetextview за мягкой клавиатурой в фрагменте диалогового окна

Вот раскладка:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:padding="10dp" 
    android:orientation="horizontal" 
    android:windowSoftInputMode="adjustPan|adjustResize"> 

    <android.widget.AutoCompleteTextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:id="@+id/customDialogAtocompleteTextview" 
     android:layout_weight=".7" 
     android:layout_gravity="top" /> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight=".3"> 
     <Button 
      android:id="@+id/customDialogBtOk" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Aceptar"/> 
     <Button 
      android:id="@+id/customDialogBtSearch" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Buscar"/> 
     <Button 
      android:id="@+id/customDialogBtMore" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Mas"/> 
    </LinearLayout> 

</LinearLayout> 

Так , как я могу сделать это, чтобы выровнять с помощью клавиатуры?

ответ

6

Теория говорит, что android:windowSoftInputMode="adjustPan|adjustResize" Шоул сделать это, но почему-то нет, поэтому вы должны сделать то же самое программно:

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

Aaaaaand магии происходит