朋友,
我正在使用以下布局和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>
答案 0 :(得分:2)
技巧不在布局中,而是在AndroidManifest.xml文件中。
确保您更新活动并删除
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
并将以下内容添加到您的活动中
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" />
答案 1 :(得分:0)
阅读documentation,然后尝试使用android:windowSoftInputMode
值来获得您想要的内容。
答案 2 :(得分:0)
在清单文件中尝试此操作
android:windowSoftInputMode="stateVisible|adjustResize|adjustPan"
和活动
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
答案 3 :(得分:0)
你可以试试这个:
myscrollView.arrowScroll(ScrollView.FOCUS_DOWN);