2016-08-15 56 views
0

我在应用程序的其他地方有对话框,工作得很好(keyboad没有隐藏视图),但是在我写的这个特定的新对话框中并没有移动当键盘打开时查看。我想不通为什么..当软键盘打开时DialogFragment不上去

我的对话框的布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:custom="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/MyLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    android:layout_margin="15dp" 
    android:background="@drawable/dialog_background" 
    android:clickable="true" 
    android:orientation="vertical" 
    custom:maxHeight="@dimen/dialog_max_height" 
    custom:maxWidth="@dimen/dialog_max_width" > 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="20dp" 
     android:layout_marginBottom="10dp" 
     android:gravity="center" 
     android:text="something" /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:orientation="vertical" > 

     <EditText 
      android:id="@+id/SomeEditText" 
      android:layout_width="match_parent" 
      android:layout_height="fill_parent" 
      android:minHeight="100dp" 
      android:layout_margin="15dp" 
      android:background="#ffffff" 
      android:gravity="right|top" 
      android:inputType="textMultiLine" 
      android:singleLine="false" 
      android:textColor="@color/edit_text_text_color" 
      android:textSize="16dp" /> 

    </LinearLayout> 

    <Button 
     android:id="@+id/SomeButton" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/dialog_button_height" 
     android:layout_margin="15dp" 
     android:text="text" /> 

</LinearLayout> 

我有我的清单

android:windowSoftInputMode="adjustPan" > 

集。

+0

显示你的清单文件。 –

+0

我有'android:windowSoftInputMode =“adjustPan”'。但它在应用程序的其他对话框中工作得很好,所以我认为它没有任何关系。我也尝试过adjustResize,但没有帮助 – BVtp

+0

在清单 –

回答

1

找到了解决办法:

我把:getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

在onCreateDialog回调

相关问题