EditText上的键盘重叠问题,调整不起作用 [英] Keyboard overlapping issue on EditText with adjustpan not working
本文介绍了EditText上的键盘重叠问题,调整不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用这个代码但键盘仍然是重叠的EditText。可以做什么
I am using this code But the keyboard is still overlapping EditText. what can be done
<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>
推荐答案
adjustResize
当您使用FullScreenActivity工作。一个解决方案是在ScrollView中包含整个布局,并在editText获得焦点时将其滚动到 editText.getY()+ editText.getMeasuredHeight()
的位置。
adjustResize
fails to work when you use a FullScreenActivity. One solution would be to contain the whole layout in a ScrollView and scroll it to position editText.getY() + editText.getMeasuredHeight()
when the editText gains focus.
或者,如果您想要快速解决问题,请查看此解决方案这里有一个类似的问题。
Or, if you want a quick fix to the problem, have at look at this solution on a similar question here.
这篇关于EditText上的键盘重叠问题,调整不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文