在android中触摸时如何移动用户名和密码布局移动

在android中触摸时如何移动用户名和密码布局移动,android,android-layout,Android,Android Layout,嗨,在下面的代码中我有这些布局。一旦触摸到用户名编辑文本内部,我想向上移动整个布局。键盘上的键应该保持不变。我想向上移动整个布局 有人能帮我吗 布局 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" andro

嗨,在下面的代码中我有这些布局。一旦触摸到用户名编辑文本内部,我想向上移动整个布局。键盘上的键应该保持不变。我想向上移动整个布局

有人能帮我吗

布局

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

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

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            >

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

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:background="@drawable/texture">

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:background="#FFFFFF"
                    android:orientation="vertical"
                    android:id="@+id/login">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:gravity="center"
                        android:paddingTop="100dp"
                        >


                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#6E6864"
                            android:text="Sign in to continue"
                            android:id="@+id/login_tv_sign_continue" />

                        <EditText
                            android:layout_width="300dp"
                            android:layout_height="50dp"
                            android:layout_marginTop="20dp"
                            android:paddingLeft="10dp"
                            android:hint="User Name"
                            android:id="@+id/login_ed_username"
                            android:background="@drawable/edit_text_back"
                            android:imeOptions="actionNext"
                            android:singleLine="true"

                            />

                        <EditText
                            android:layout_width="300dp"
                            android:layout_height="50dp"
                            android:layout_marginTop="20dp"
                            android:paddingLeft="10dp"
                            android:hint="Password"
                            android:id="@+id/login_ed_password"
                            android:background="@drawable/edit_text_back"
                            android:imeOptions="actionDone"
                            android:singleLine="true"
                            android:inputType="textPassword"

                            />

                        <Button
                            android:layout_width="300dp"
                            android:layout_height="50dp"
                            android:layout_marginTop="20dp"
                            android:textColor="#6E6864"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:id="@+id/login_btn_login"
                            android:text="Sign In"
                            android:background="#ECBC3B"
                            />

                        <TextView
                            android:layout_width="300dp"
                            android:layout_height="wrap_content"
                            android:textAppearance="?android:attr/textAppearanceSmall"
                            android:id="@+id/txt_forgetpwd"
                            android:text="Forgot Password?"
                            android:gravity="right"
                            android:layout_marginTop="20dp"
                            />

                    </LinearLayout>

                </LinearLayout>

            </LinearLayout>

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/logo"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                />

        </RelativeLayout>

    </LinearLayout>
</ScrollView>


您能否为我们展示此视图的任何模型(我的意思是,如果您有任何图像,请在此处共享)。您在这里给出的布局似乎不正确。此外,根据您的需要,您可以尝试使用windowssoftinputmode:adjustpan@Rotomac17是的,我在清单活动中添加了,然后也不起作用。onfouse on edittext想要移动到顶部您能给我显示布局的确切图像吗?同一屏幕