我的键盘没有弹出edittext来输入文本。我尝试在我的android清单中的windowSoftInputMode中设置adjustSize。
这是我的 AndroidManifest.xml
<activity
android:windowSoftInputMode="adjustResize"
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
我只有一个editText
<EditText
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:background="@drawable/edittext_background"
android:hint="@string/message_hint"
android:textColorHint="@android:color/darker_gray"
android:textStyle="bold" />
这是我的整个布局。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="80dp"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.RecyclerView
android:id="@+id/chatList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<RelativeLayout
android:id="@+id/appbarlayout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentTop="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
android:gravity="center_vertical"
android:padding="16dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/button_gradient"
android:src="@drawable/add" />
<EditText
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:background="@drawable/edittext_background"
android:hint="@string/message_hint"
android:textColorHint="@android:color/darker_gray"
android:textStyle="bold" />
<ImageView
android:layout_width="33dp"
android:layout_height="33dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/mic" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/camera" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
我从 AndroidManifest 和 Programatically 尝试了 windowSoftInputMode 的所有其他选项,但没有工作。我也尝试使用 ScrollView 作为根布局。但仍然无法正常工作。