gpt4 book ai didi

Android,注册按钮上移

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

我是 android 及其布局的新手。我设计了注册屏幕,但它有问题。问题是当我开始数据输入时,SIGNUP 按钮随着键盘向上移动并覆盖密码字段,它应该留在原处。 我该如何解决?我的 XML 代码如下。

<?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="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >

<LinearLayout
android:id="@+id/headerLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:orientation="horizontal" >

<TextView
android:id="@+id/headerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="SIGN UP"
android:textColor="#00aeef"
android:textSize="22dp" />
</LinearLayout>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical" >

<EditText
android:id="@+id/fname"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@drawable/edit_text_design"
android:ems="10"
android:hint="First Name"
android:inputType="textCapSentences">

<requestFocus />
</EditText>

<EditText
android:id="@+id/lname"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="@drawable/edit_text_design"
android:ems="10"
android:hint="Last Name"
android:inputType="textCapSentences"/>

<EditText
android:id="@+id/eemail"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="@drawable/edit_text_design"
android:ems="10"
android:hint="Email"
android:inputType="textEmailAddress" >
</EditText>

<EditText
android:id="@+id/pass"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="@drawable/edit_text_design"
android:ems="10"
android:hint="Password"
android:inputType="textPassword" />
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_alignParentBottom="true">

<Button
android:id="@+id/signupBtn"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:background="#ffffff"
android:text="SIGN UP"
android:textColor="#00aeef"
android:textSize="36dp" />
</LinearLayout>

</RelativeLayout>

谢谢

最佳答案

尝试在您的 list 中更改 Activity 的 android:windowSoftInputMode="adjustNothing"

例如:

<activity
android:windowSoftInputMode="adjustNothing"
android:name=".SongPlayActivity"
android:label="@string/title_activity_song_play" >
</activity>

如果这不起作用,则尝试为 windowSoftInputMode 设置不同的值。

关于Android,注册按钮上移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27478928/

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