gpt4 book ai didi

Android,在编辑文本中进行输入时,防止相对布局底部对齐的按钮上升

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:30:42 25 4
gpt4 key购买 nike

我创建了一个包含 3 个 ListView 的相对布局。在顶部我有一个 editText 字段。中间有一个 ScrollView ,可以填充所有剩余空间。在底部我放置了一个按钮。问题是,当我在 editText 字段中进行输入时,键盘出现,然后按钮被移动并放置在键盘上。看起来按钮总是粘在“左” View 的底部,但我希望它保留在原始窗口的底部。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:id="@+id/ll_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
>

<TextView
android:id="@+id/tv_course_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_view_course_name"
android:textStyle="bold" />

<EditText
android:id="@+id/et_course_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" />

</LinearLayout>

<LinearLayout
android:id="@+id/ll_save_course_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="saveCourse"
android:text="@string/button_save_course" />

</LinearLayout>

<LinearLayout
android:id="@+id/ll_course_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/ll_save_course_button"
android:layout_below="@id/ll_name" >

</LinearLayout>


</RelativeLayout>

最佳答案

在你的 list 文件中,

        <activity
android:name=".HomeActivity"
android:windowSoftInputMode="stateHidden|adjustPan" >

注意:在这里,我使用了 HomeActivity,您需要指定要在其中设置上述布局 xml 文件的 Activity 名称。

关于Android,在编辑文本中进行输入时,防止相对布局底部对齐的按钮上升,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14661896/

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