钮的位置改变,当键盘被显示在Android版 [英] Button Changes it position when Keyboard gets displayed in Android
问题描述
我尝试做如下设计
我的XML code是如下
My XML Code is as follow
<?xml version="1.0" encoding="utf-8"?>
<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="fill_parent"
android:layout_gravity="fill_vertical" >
<EditText
android:id="@+id/patientid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_toLeftOf="@+id/speak"
android:ems="10"
android:hint="@string/patientidhint" >
<requestFocus />
</EditText>
<Button
android:id="@+id/speak"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/patientid"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:onClick="speak"
android:text="@string/speak"
tools:context=".CreatingPatientFolder"
/>
<ListView
android:id="@+id/lvTextMatches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/speak"
android:layout_above="@+id/btn_Submit"/>
<Button
android:id="@+id/btn_Submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:layout_alignParentBottom="true"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="10dp"
android:text="Submit"
android:textSize="20sp"
tools:ignore="HardcodedText" />
</RelativeLayout>
现在,当我运行这个项目它就会显示如下
Now when I run this project it gets displayed as follow
所以,任何一个可以告诉我为什么我的按钮越来越呈现上行趋势还请大家帮我删除这个问题。
So can any one please tell me why my button is getting shift upwards also please help me to remove this issue.
推荐答案
我觉得为什么按钮移动的原因是因为你的列表是空的,你有足够的空间移动的按钮,按钮没有吼叫编辑文本因此它可以重叠它
I think the reason why the button is moved is because your list is empty, you have enough room to move the button and the button is not bellow the edit text, therefore it can overlap it.
有一个名为您的清单属性 windowSoftInputMode 一>。该属性指定软键盘应该如何表现。
There is a property in your manifest called "windowSoftInputMode". This property specifies how the soft keyboard should behave.
您可以使用:
android:windowSoftInputMode="stateVisible|adjustNothing
这篇关于钮的位置改变,当键盘被显示在Android版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!