gpt4 book ai didi

android - editText 和软键盘之间的空间

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:04:18 25 4
gpt4 key购买 nike

我有一个 editText 字段几乎在底部的 Activity 。当我专注于那个 editText 字段时,键盘会出现并将我的 edittext 字段向上推。

当它停止时,editText 和我的软键盘之间没有空格。

是否可以增加一些 margin ?

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_yellow"
android:orientation="vertical"
>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:paddingTop="25dp"
>

<RelativeLayout
android:layout_width="340dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
>

<EditText
android:layout_width="340dp"
android:layout_height="45dp"
android:background="@drawable/edit_text_field"
android:inputType="text"
/>

</RelativeLayout>
</RelativeLayout>

键盘出现前 editText 字段的位置: http://postimg.org/image/826fwy18z/

和键盘显示时的图像,光标和键盘之间没有空格: http://postimg.org/image/97qlfb4zx/

最佳答案

您可以使用 android:windowSoftInputMode list 文件中 Activity 的属性。

在您的情况下使用 android:windowSoftInputMode="adjustResize"。您也可以检查其他属性。

希望这对您有所帮助。

谢谢。

关于android - editText 和软键盘之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20010187/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com