friend ,
我正在使用以下布局和 tring 输入文本,然后保存数据,但是当我单击 EditText 键入内容时遇到一个问题。
键盘出现并覆盖了 EditText 和按钮布局的一半。 但是当我输入它时它显示完整。在输入之前键盘覆盖了一半的 Edittext 布局。
谁能指导我如何在出现键盘后显示带有按钮的整个文本框?
我们将不胜感激。
<LinearLayout
android:layout_width="fill_parent"
android:id="@+id/LayoutReply"
android:layout_height="wrap_content"
android:background="#ffcc33"
android:layout_alignParentBottom="true"
android:paddingBottom="50px"
android:orientation="horizontal"
>
<EditText
android:id="@+id/txtMessage"
android:hint="Please enter text to reply!"
android:layout_width="wrap_content"
android:maxLength="160"
android:layout_height="wrap_content"
></EditText>
<Button android:layout_height="wrap_content" android:id="@+id/btnPostReply"
android:layout_width="wrap_content"
android:text="@string/Message_Reply"></Button>
</LinearLayout>
最佳答案
诀窍不在于布局,而在于您的 AndroidManifest.xml 文件。
确保更新您的 Activity 并删除
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
并将以下内容添加到您的 Activity 中
android:windowSoftInputMode="adjustResize"
我的布局在下面,但它与修复无关
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/editTextBug"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".5"
android:ems="10"
android:gravity="top|left"
android:height="150dp"
android:hint="@string/reportBug"
android:inputType="textMultiLine" />
<Button
android:id="@+id/buttonSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/submitBug" />
关于android - 在android中出现键盘后如何显示完整的EditText?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2342691/