gpt4 book ai didi

Android UI 问题 - 底部按钮在键盘上方向上滚动

转载 作者:搜寻专家 更新时间:2023-11-01 09:36:38 24 4
gpt4 key购买 nike

我遇到了 android UI 的问题,当键盘出现时,底部的按钮也会在键盘上方弹出。我想在出现键盘时滚动编辑文本(仅编辑文本)。这是我的 xml 代码,有人可以帮助我吗?我已经尝试过使用 adjustPan - 它会随着屏幕滚动工具栏。

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/ScrollView01"
android:fillViewport="true"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:weightSum="1.0"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:id="@+id/l_layout">
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/editText1"
android:layout_marginTop="100dp">
<requestFocus></requestFocus>
</EditText>
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/editText2"
android:layout_marginTop="100dp">
</EditText>

<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/editText3"
android:layout_marginTop="100dp">
<requestFocus></requestFocus>
</EditText>
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/editText4"
android:layout_marginTop="100dp">
<requestFocus></requestFocus>
</EditText>
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/editText5"
android:layout_marginTop="100dp">
<requestFocus></requestFocus>
</EditText>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Go next page"
android:layout_alignParentRight="true" />
</RelativeLayout>
</LinearLayout>

最佳答案

您只需将 Activity 的 windowSoftInputMode 标志切换为“adjustPan”即可。检查official documentation获取更多信息。在 android Manifest.xml 文件中,添加以下内容。

<activity
...
android:windowSoftInputMode="adjustPan">
</activity>

关于Android UI 问题 - 底部按钮在键盘上方向上滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42640404/

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