我正在使用这段代码,但键盘仍然是重叠的EditText。能做些什么
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeContainer"
android:layout_below="@+id/optionsBar"
android:layout_above="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animationCache="false"
android:divider="@null"
android:scrollbars="none"
android:overScrollMode="never"
android:dividerHeight="0dp"
android:listSelector="#00000000"
android:fadingEdge="none"
android:scrollingCache="false"
/>
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/bottomBar"
android:background="@drawable/top_bar_bg"
>
<EditText
android:layout_width="match_parent"
android:layout_height="30dp"
android:inputType="text"
android:paddingLeft="10dp"
android:paddingRight="43dp"
android:layout_marginRight="5dp"
android:layout_centerVertical="true"
android:maxLines="1"
android:hint="Your Message"
android:textColorHint="@android:color/white"
android:layout_marginLeft="5dp"
android:textColor="@android:color/white"
android:textSize="12sp"
android:id="@+id/chatBox"
android:background="@drawable/message_type_area"
/>
<Button
android:gravity="center"
android:layout_height="23dp"
android:layout_width="37dp"
android:contentDescription="@null"
android:background="@drawable/send_btn"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:id="@+id/sendBtn"/>
</RelativeLayout>
</RelativeLayout>
<activity
android:name=".ChatActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait" >
</activity>
发布于 2015-01-25 11:28:16
当您使用adjustResize
时,FullScreenActivity无法工作。一种解决方案是将整个布局包含在ScrollView中,并在editText.getY() + editText.getMeasuredHeight()
获得焦点时将其滚动到定位editText。
或者,如果您想快速解决这个问题,请在这里查看一下this solution上的类似问题。
发布于 2015-01-25 11:28:08
发布于 2017-02-13 04:43:57
属性android:windowSoftInputMode="adjustResize“不适用于全屏活动,您必须删除活动全屏标志,以获得调整大小的优势。
RESIZE for the window's softInputMode field; the window will stay fullscreen and will not resize.
https://stackoverflow.com/questions/28140245
复制相似问题