如何更改 windowSoftInputMode

How to change windowSoftInputMode

我有一个 Android 应用程序,它可以工作。在一个 activity 中,我有一个简单的 EditText 和一个 Button。因此,当我单击 EditText 时,键盘会显示,但它位于按钮上。我不想要这个,我不知道是否可以在显示键盘时转换到组件顶部。

这是Android清单的代码:

<activity
   android:name="com.bioresult.geopointer.activity.settingActivity"
   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
   android:windowSoftInputMode="stateVisible|adjustResize"
   android:configChanges="orientation|screenSize">            
</activity>

这是activity的鳕鱼:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="#4d4d4d"
    android:gravity="center_horizontal"
    android:baselineAligned="false">

    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        android:layout_gravity="center_vertical|center_horizontal"
        android:gravity="center_vertical|center_horizontal"
        android:layout_margin="15dp">

        <EditText
           android:id="@+id/editTextPartitaIva" 
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:hint="@string/nomeAzienda"
           android:lines="1"
           android:singleLine="true"/>   

        <Button 
           android:id="@+id/buttonSalva" 
           android:layout_width="match_parent"
           android:layout_height="40dp"
           android:layout_marginTop="15dp"
           android:textColor="#FFFFFF"
           android:text="@string/salva"
           android:textSize="20sp"
           android:onClick="salva"
           android:background="@drawable/salva_partitaiva_button"
           />
    </LinearLayout>



</LinearLayout>

https://code.google.com/p/android/issues/detail?id=5497

为避免这种情况,请删除 activity

FullScreen 主题

来自FLAG_FULLSCREEN

Window flag: hide all screen decorations (such as the status bar) while this window is displayed. This allows the window to use the entire display space for itself -- the status bar will be hidden when an app window with this flag set is on the top layer. A fullscreen window will ignore a value of SOFT_INPUT_ADJUST_RESIZE for the window's softInputMode field; the window will stay fullscreen and will not resize.