gpt4 book ai didi

Android 滚动容器 - 聚焦时看不到 EditText

转载 作者:搜寻专家 更新时间:2023-11-01 07:53:40 26 4
gpt4 key购买 nike

我有一个 android 布局文件的小问题,当用户触摸 EditText 时,键盘出现但将 edittext 隐藏在键盘后面......这是因为我将登录按钮保留在键盘上方......

我的 XML 文件如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:clickable="true"
android:orientation="vertical">


<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">


<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:orientation="vertical"
android:paddingLeft="25dp"
android:paddingRight="25dp">

<ImageView
android:layout_width="fill_parent"
android:layout_height="100dp"
android:contentDescription="logo"
android:paddingTop="10dp"
android:src="@drawable/ic_launcher"/>


<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="Driver ID"
android:textColor="@color/red"/>

<EditText
android:id="@+id/driver_id"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@drawable/rounded_text"
android:hint="Only digits allowed"
android:inputType="number"
android:text="1"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="Registration"
android:textColor="@color/red"/>

<EditText
android:id="@+id/registration"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@drawable/rounded_text"
android:hint="Only letters and digits allowed"
android:inputType="text|textCapCharacters|textNoSuggestions"
android:text="KV61 YVZ"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="Pin"
android:textColor="@color/red"/>

<EditText
android:id="@+id/pin"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@drawable/rounded_text"
android:hint="Please Enter your pin"
android:imeOptions="actionSend"
android:inputType="numberPassword"
android:text="9999"/>

</LinearLayout>


</LinearLayout>

</ScrollView>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:paddingTop="10dp">

<Button
android:id="@+id/logon_btn"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@color/green"
android:text="Log On"
android:textColor="@color/black"
android:textSize="21dp"
android:textStyle="bold"/>

</RelativeLayout>

</RelativeLayout>

以下是部分截图:键盘不显示: Keyboard not showing

键盘显示: Keyboard showing

我希望这样,当用户触摸“图钉”EditText 时,他们可以看到他们正在输入的内容。提前致谢:)

我已经尝试了下面提到的修复:

这是行不通的。还有其他提示吗?谢谢:)

最佳答案

在Manifest中,你需要为activity设置windowSoftInputModeadjustPan

<activity android:name="your activity"
android:windowSoftInputMode="adjustPan">
</activity>

关于Android 滚动容器 - 聚焦时看不到 EditText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31266235/

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