Android-编辑文本和发送/退出按钮
我正在完成一个应用程序的实现,该应用程序具有用于发送消息的内部活动(只有editText和两个按钮-发送和取消,然后将消息发送到固定地址)。当我开始这项活动时,我会在屏幕上看到文本框和键盘,它们会立即显示出来。但这样做的缺点是这些按钮被键盘覆盖或半覆盖,我想要的只是和信息中的按钮相似。当键盘可见时,缩小文本字段并在键盘上方显示添加按钮,如果我在屏幕下按上箭头,键盘将消失,几乎整个屏幕将被此编辑文本占据,底部将显示这两个按钮。。。这是真的吗 编辑:如何使它发生,这个屏幕将有活动键盘可见的所有按钮Android-编辑文本和发送/退出按钮,android,android-edittext,Android,Android Edittext,我正在完成一个应用程序的实现,该应用程序具有用于发送消息的内部活动(只有editText和两个按钮-发送和取消,然后将消息发送到固定地址)。当我开始这项活动时,我会在屏幕上看到文本框和键盘,它们会立即显示出来。但这样做的缺点是这些按钮被键盘覆盖或半覆盖,我想要的只是和信息中的按钮相似。当键盘可见时,缩小文本字段并在键盘上方显示添加按钮,如果我在屏幕下按上箭头,键盘将消失,几乎整个屏幕将被此编辑文本占据,底部将显示这两个按钮。。。这是真的吗 编辑:如何使它发生,这个屏幕将有活动键盘可见的所有按钮
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent"
android:background="@drawable/poz3"
android:padding="10dip">
<TextView
android:text="Message:"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="25dip"
android:textColor="@color/black"
/>
<EditText
android:id="@+id/message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Write message here"
android:gravity="top"
android:lines="7"
android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
android:imeOptions="actionSend|flagNoEnterAction"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/enquirySendButton"
android:layout_width="fill_parent"
android:layout_height="60dip"
android:text="Send"
android:layout_weight="1.0"
android:background="@drawable/custom_button"
/>
<Button
android:id="@+id/enquiryExitButton"
android:layout_width="fill_parent"
android:layout_height="60dip"
android:text="Cancel"
android:layout_weight="1.0"
android:background="@drawable/custom_button"
/>
</LinearLayout>
</LinearLayout>
如果尚未尝试,这可能会有所帮助 我已经让它工作了。 在XML布局中,在主布局(RelativeLayout)中有一个带有按钮和android:layout\u alignParentBottom=“true”的线性布局。在下面添加其他布局,并在上面添加android:layout_=“@id/yourButtonLayout”子句 我的真实生活代码是这样的:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="14dip"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/taskEditFormBottomButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="true"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
>
<Button
android:id="@+id/taskEditFormBTSave"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/save"
android:layout_weight="0.5"
/>
<Button
android:id="@+id/taskEditFormBTCancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/cancel"
android:layout_weight="0.5"
/>
</LinearLayout>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/taskEditFormBottomButtons"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
....
>
....
</RelativeLayout>
</ScrollView>
</RelativeLayout>
....
Buddy,请正确解释您的查询。或者此链接将帮助您更新XML。。。我从Android开发者那里尝试过这个页面,仍然有同样的问题,我尝试过,设置所有内容,添加到editText,到manifest,它仍然和以前一样,你在两个方向(垂直和横向)上都遇到同样的问题?我刚刚在我的应用程序中批准了垂直方向,但是现在已经解决了谢谢你的回答,我现在就去试试