当键盘出现时,Android将滚动到底部

当键盘出现时,Android将滚动到底部,android,login,screen,Android,Login,Screen,我想我在互联网上尝试了所有的解决方案,但在我的登录屏幕上,登录按钮仍然在键盘下。 我想在键盘出现时自动滚动到底部。 这是我的xml代码 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ScrollView01" android:layout_width="match_parent" android:layout_height="match_parent" andr

我想我在互联网上尝试了所有的解决方案,但在我的登录屏幕上,登录按钮仍然在键盘下。 我想在键盘出现时自动滚动到底部。 这是我的xml代码

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none" >


<RelativeLayout 
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:theme="@android:style/Theme.NoTitleBar"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#13a7d8"
 >

  <ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="-120dp"
    android:src="@drawable/logo_login" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textView1"
    android:layout_centerHorizontal="true"
    android:ems="10"
    android:inputType="textEmailAddress" />

<EditText
    android:id="@+id/editText2"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/benimlabel2"
    android:layout_centerHorizontal="true"
    android:ems="10"
    android:inputType="textPassword" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageView1"
    android:layout_marginTop="-130dp"
    android:layout_alignLeft="@+id/editText1"
    android:textColor="#FFFFFF"
    android:text="@string/eposta"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/benimlabel2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/editText1"
    android:layout_alignLeft="@+id/editText2"
    android:textColor="#FFFFFF"
    android:text="@string/sifre"
    android:textAppearance="?android:attr/textAppearanceLarge" />



<Button
    android:id="@+id/button1"
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:layout_below="@+id/editText2"
    android:layout_centerHorizontal="true"
    android:text="@string/girisyap" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/button1"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="30dp"
    android:text="Hesabın yoksa, hemen kayıt ol"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="#FFFFFF"
    android:clickable="true"
    android:onClick="kayitol" />

</RelativeLayout>
</ScrollView>
其他尝试

android:windowSoftInputMode="stateVisible"

我怎样才能解决这个问题

这个代码对我很有用

将此内容放在活动的onResume()中

((ScrollView) findViewById(R.id.ScrollView01)).post(new Runnable() 
{
    public void run() 
    {
        ((ScrollView) findViewById(R.id.ScrollView01)).fullScroll(View.FOCUS_DOWN);
}
});

你试过了吗:?把登录按钮放在下面的一边,或者让它隐藏登录按钮,然后在“完成”时执行登录操作,按IME(软键盘)是的,我试过了,但没有成功。因为我的xml是不可滚动的。当键盘出现时,我无法滚动屏幕。谢谢Arnav M,但我的目标用户将查找登录按钮。和旁边的登录按钮将缩小其他对象的范围。尝试使用:android:WindowsOfInputMode=“stateHidden | adjustResize”我以前看到过这段代码,但我不知道该放在哪里我尝试过这样@Override protected void onResume(){((ScrollView)findViewById(R.id.ScrollView01)).post(new Runnable(){public void run(){((ScrollView)findViewById(R.id.ScrollView01)).fullScroll(View.FOCUS_DOWN);}}}}但是代码错误:(((ScrollView)findViewById(R.id.ScrollView01))没有建议
((ScrollView) findViewById(R.id.ScrollView01)).post(new Runnable() 
{
    public void run() 
    {
        ((ScrollView) findViewById(R.id.ScrollView01)).fullScroll(View.FOCUS_DOWN);
}
});