2015-08-08 6 views
1

У меня есть пользовательский диалоговое окно, как показано ниже:Диалог частично отображается, когда SoftKeyBoard показано

enter image description here

Когда я нажимаю на Edit Text, диалог смещается вверх, а половина диалога становится невидимым, как ниже: enter image description here

Я проверял проблему на Android ICS и Gingerbread, но этого не происходит на Android Lollipop.

Я ценю вашу помощь для выяснения причин.

Вот пользовательский диалог расположение XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/layoutChatInGame" 
android:layout_width="305dp" 
android:layout_height="190dp" 
android:background="@drawable/dialog_table_border" 
android:orientation="vertical" 
android:visibility="visible"> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/roomlist_title_background"> 

    <ProgressBar 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/progressBar" 
     android:layout_margin="5dp"/> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_gravity="center" 
     android:layout_margin="5dp"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical"> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:text="Game is on hold because the host paused the app" 
       android:id="@+id/lblOnHoldDialogMessage" 
       android:textColor="@color/progress_dialog_on_hold_text" 
       android:textSize="18dp" 
       android:singleLine="false" 
       android:layout_gravity="center_horizontal"/> 
     </LinearLayout> 
    </LinearLayout> 

</LinearLayout> 

<TextView 
    android:id="@+id/lblChatHistoryGameOnHold" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="1" 
    android:gravity="bottom" 
    android:maxLines="5" 
    android:scrollbars="vertical" 
    android:textColor="@color/edit_text_general_text" 
    android:textColorHint="@color/edit_text_general_hint" 
    android:paddingRight="2dp" 
    android:paddingLeft="2dp"/> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <EditText 
     android:id="@+id/textChatGameOnHold" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="2dp" 
     android:layout_marginStart="2dp" 
     android:layout_weight="1" 
     android:ems="10" 
     android:hint="@string/edit_text_send_chat_message" 
     android:imeOptions="flagNoExtractUi|actionDone" 
     android:inputType="text" 
     android:maxLength="100" 
     android:maxLines="1" 
     android:textColor="@color/edit_text_general_text" 
     android:textColorHint="@color/edit_text_general_hint"/> 

    <Button 
     android:id="@+id/btnSendGameOnHold" 
     style="@style/lightboxButton.Blue" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:onClick="sendChatMessageInGame" 
     android:text="@string/btn_send"/> 
</LinearLayout> 

</LinearLayout> 

ответ

1

Попробуйте также использовать Android: imeOptions = "flagNoFullscreen" в вашем .xml. Порекомендуйте вам несколько тестов, используя его с и без flagNoExtractUi. Пожалуйста, дайте мне несколько отзывов.

+0

Спасибо за ваш ответ, используя 'Android: imeOptions =" ​​flagNoFullscreen' на 'EditText' сделал трюк –

+0

Нет проблем счастлив.. вы. –

-1

Вы можете получить желаемое поведение, делая флаг adjustResize для windowSoftInputMode диалога в манифесте, если ваш диалог объявлен как деятельность.

Like This:

android:windowSoftInputMode="adjustResize|stateHidden" 

Вы можете также непосредственно попробовать что-то вроде этого непосредственно в диалоговом окне:

alertDialog.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
+0

я получаю тот же результат с 'adjustResize' или' adjustResize | stateHidden' –