Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android编辑文本和按钮压缩视图_Android_Button_Android Edittext - Fatal编程技术网

Android编辑文本和按钮压缩视图

Android编辑文本和按钮压缩视图,android,button,android-edittext,Android,Button,Android Edittext,嗨,在我的android应用程序中,我有两个edittext和一个与Facebook相同的按钮用于登录,底部有两个TextView用于忘记密码和新用户。当我在first edittext中输入任何内容时,keybord将隐藏按钮和底部的文本视图。我需要的是,当键盘被打开时,两个编辑文本和按钮应该和底部的文本视图一起可见,就像Facebook登录页面一样。。如果有人能帮忙,请帮我怎么办 <RelativeLayout xmlns:android="http://schemas.and

嗨,在我的android应用程序中,我有两个edittext和一个与Facebook相同的按钮用于登录,底部有两个TextView用于忘记密码和新用户。当我在first edittext中输入任何内容时,keybord将隐藏按钮和底部的文本视图。我需要的是,当键盘被打开时,两个编辑文本和按钮应该和底部的文本视图一起可见,就像Facebook登录页面一样。。如果有人能帮忙,请帮我怎么办

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

    <LinearLayout
        android:id="@+id/logo"
        android:layout_alignParentTop="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:background="@color/red">
        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/contentDescriptionContent"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:src="@mipmap/logo" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/loginNow"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/logo"
        android:gravity="center"
        android:background="@drawable/main_header_selector">
        <TextView
            android:id="@+id/textViewAboutUs"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:text="LOGIN NOW"
            android:textColor="@color/red"
            android:shadowColor="#FFFFFF"
            android:shadowDx="1"
            android:shadowDy="1"
            android:shadowRadius="2"
            android:textSize="18sp"
            android:textStyle="bold" />
    </LinearLayout>





            <EditText
                android:id="@+id/editTextUserName"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Mobile Number"
                android:inputType="number"
                android:maxLines="1"
                android:maxLength="10"
                android:padding="10dp"
                android:layout_marginBottom="2dp"
                android:background="@drawable/rect_text_edittext"
                android:layout_marginLeft="50dp"
                android:layout_marginRight="50dp"
                android:layout_above="@+id/editTextPassword"/>



            <EditText
                android:id="@+id/editTextPassword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/password"
                android:inputType="textPassword"
                android:maxLines="1"
                android:padding="10dp"
                android:background="@drawable/rect_text_edittext"
                android:layout_above="@+id/login_Button"
                android:layout_marginLeft="50dp"
                android:layout_marginRight="50dp"
                android:layout_marginBottom="8dp"/>

            <Button
                android:id="@+id/login_Button"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="50dp"
                android:layout_marginRight="50dp"
                android:layout_centerHorizontal="true"
                android:layout_centerInParent="true"
                android:shadowColor="#000000"
                android:shadowDx="1"
                android:shadowDy="1"
                android:shadowRadius="2"
                android:minHeight="30dp"
                android:gravity="center"
                android:textColor="#ffffff"

                android:background="@drawable/custom_button"
                android:text="@string/login" />



            <TextView
                android:id="@+id/textViewIfNewUser"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_above="@+id/textViewIfForgotPassword"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="55dp"
                android:layout_alignParentLeft="true"
                android:text="@string/ifnewuser"
                android:textColor="#000000"
                android:textStyle="italic|bold"/>

            <TextView
                android:id="@+id/textViewNewUser"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/textViewIfNewUser"
                android:layout_alignBaseline="@+id/textViewIfNewUser"
                android:layout_marginLeft="8dp"
                android:text="@string/newuser"
                android:textColor="@drawable/text_color_red"
                android:textStyle="italic|bold"/>

            <TextView
                android:id="@+id/textViewIfForgotPassword"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="55dp"
                android:layout_alignParentLeft="true"
                android:text="@string/ifforgotpassword"
                android:textColor="#000000"
                android:textStyle="italic|bold"/>

            <TextView
                android:id="@+id/textViewForgotPassword"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/textViewIfForgotPassword"
                android:layout_alignBaseline="@+id/textViewIfForgotPassword"
                android:layout_marginLeft="8dp"
                android:text="@string/forgotpassword"
                android:textColor="@drawable/text_color_red"
                android:textStyle="italic|bold"/>

        </RelativeLayout>


您可以使用android:WindowsofInputMode=“adjustResize”/>对清单中的相同活动进行操作,这将帮助您调整布局视图中的软键盘大小。

添加一个
滚动视图作为视图的父级布局,并添加

android:fillViewport=“true”

还要将其添加到清单文件中的活动:

android:windowSoftInputMode="adjustResize"

ScrollView
将在键盘打开时显示。

我已经给出了“android:WindowsofInputMode=“adjustResize | stateHidden”您的ScrollView的高度设置为多少?