[英]Softkeyboard overlaps EditText
My root layout is: 我的根布局是:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/toolbar" />
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
content FrameLayout being replaced with this layout: 内容FrameLayout替换为以下布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="UnusedAttribute">
<FrameLayout
android:id="@+id/messages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@+id/messageLayout">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/emptyView"
android:text="@string/no_messages"
android:textSize="18sp"
android:textColor="?attr/colorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible"/>
<af.kabuljan.android.ui.widget.EmptyRecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="4dp"
android:background="@color/md_indigo_100"/>
<ProgressBar
android:id="@+id/progressView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible"/>
</FrameLayout>
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:elevation="8dp">
<ImageView
android:id="@+id/btnAttach"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_attachment"
android:tint="@color/primary_dark"
android:padding="4dp"
android:layout_alignParentLeft="true"/>
<android.support.v7.widget.AppCompatEditText
android:id="@+id/message"
android:hint="@string/enterMessage"
android:textSize="18sp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/btnAttach"
android:layout_toLeftOf="@+id/btnSend"
android:background="#00000000"
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
android:imeOptions="actionSend|flagNoEnterAction"
android:padding="4dp"
android:gravity="center_vertical"/>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btnSend"
android:text="@string/send"
android:textColor="@android:color/white"
android:background="@drawable/send_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="4dp"
app:elevation="4dp"/>
</RelativeLayout>
</RelativeLayout>
Let's assume this is a messaging app and this window has a recyclerView with bubble messages which can be scrolled, but bottom input should be always at bottom. 让我们假设这是一个消息传递应用程序,并且该窗口具有带气泡消息的recyclerView,可以滚动该消息,但底部输入应始终位于底部。 The problem is when i tap EditText - softkeyboard always overlaps this EditText.
问题是当我点击EditText时-软键盘始终与该EditText重叠。 What should i do to make whole container (toolbar+recyclerView+bottom input) be resized to lay out softkeyboard to the bottom?
我应该怎么做才能调整整个容器(工具栏+ recyclerView +底部输入)的大小,以将软键盘布局到底部?
Tried adjustResize
- no result. 尝试了
adjustResize
没有结果。 I've attached 2 screenshots. 我已附上2个屏幕截图。 1st - wrong, 2nd - correct.
第一-错误,第二-正确。
Yeah you were on the right track with the adjustResize
, that's what you should do to specify the desired activity layout behaviour wwith the soft keyboard. 是的,您使用
adjustResize
处于正确的轨道,这是您应该使用软键盘指定所需的活动布局行为的方式。
What setting did you try, and did it have any affect? 您尝试过什么设置,并且有什么影响?
The docs are here: https://developer.android.com/guide/topics/manifest/activity-element.html#wsoft 这些文档在这里: https : //developer.android.com/guide/topics/manifest/activity-element.html#wsoft
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.