更新时间:2023-01-26 07:51:41
应用此,让我知道它仍然发生与否。
Apply this and let me know is it still happening or not .
activity_mian.xml
<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"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/xxx.jpg"
android:orientation="vertical"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginTop="20dp"
android:src="@drawable/logo_app" />
<EditText
android:id="@+id/edtEmail"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/login_textbox"
android:ems="10"
android:hint="Email"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textColor="#ffffff"
android:textCursorDrawable="@null" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/edtPassword"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/login_textbox"
android:ems="10"
android:hint="Password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="#ffffff"
android:textCursorDrawable="@null" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/edtPassword"
android:layout_marginTop="2dp" />
</RelativeLayout>
<CheckBox
android:id="@+id/checkBox_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:button="@drawable/checkbox_selector"
android:checked="true"
android:focusable="false"
android:focusableInTouchMode="true"
android:text=" Remember Me"
android:textColor="#ffffff" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="top|center_vertical|center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_login" />
</LinearLayout>
</LinearLayout>
</ScrollView>
设置按钮,的EditText等内部后跟一个父一个线性布局滚动型。
set your Button, EditText etc.. inside one linear layout followed by one parent ScrollView .
另一个事情是,将的android:windowSoftInputMode =stateAlwaysHidden
你的java文件中在您的XML文件进行绑定。
one another thing is that set android:windowSoftInputMode="stateAlwaysHidden" inside your java file where your xml file is bind .