当出现Android的软键盘战利品布局 [英] android soft keyboard spoils layout when appears
问题描述
下面是一个布局:
<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" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
<FrameLayout
android:background="#0000ff"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
</LinearLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
我想蓝条保持不动时的EditText被感动,会出现软键盘。即我想它的大小和位置要preserved。我尝试了所有四种可能的值,我活动的参数安卓windowSoftInputMode
在AndroidManifest。而一直是我的蓝条移动或缩小软键盘显示:
I want blue bar to remain intact when EditText is touched and soft keyboard appears. I.e. I want its size and position to be preserved. I tried all four possible values for my activity's parameter android:windowSoftInputMode
in the AndroidManifest. And always my blue bar moves or shrinks on soft keyboard appearing:
安卓windowSoftInputMode =adjustUnspecified
或默认:
安卓windowSoftInputMode =adjustPan
或安卓windowSoftInputMode =adjustNothing
:
安卓windowSoftInputMode =adjustResize
:
有没有可能时,将出现软KEYB以保持相同的大小和位置?
Is it ever possible to keep it the same size and position when soft keyb appears?
推荐答案
由于输入正在进入一个的EditText
的你,它总是会移动的东西。
Since the input is coming into an EditText
of yours, it's always going to move something.
考虑有两个布局,一个是当键盘了,一个是当键盘了。
Consider having two layouts, one for when the keyboard is down, one for when the keyboard is up.
使用 ViewSwitcher
可能有助于这一点。
Using a ViewSwitcher
may help with that.
这篇关于当出现Android的软键盘战利品布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!