我在android项目中使用以下代码来自xml文件。 Ther是一个EditText,布局使用了scrollview。当我点击EditText并写下一些东西并按回然后软键盘消失但屏幕的下半部分不显示,直到我再次按下屏幕。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="#e9eaee"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/RelativeLayout09"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="1dp">
</LinearLayout>
<RelativeLayout
android:id="@+id/RelativeLayout11"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#ff4433">
</RelativeLayout>
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_below="@+id/RelativeLayout11"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#595B5C"/>
<TextView
android:id="@+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/RelativeLayout11"
android:layout_marginTop="410dp"
android:layout_toRightOf="@+id/textView7"
android:text="..."/>
<RelativeLayout
android:id="@+id/RelativeLayout14"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/RelativeLayout07"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/layout_style_white_color_with_dark_bg">
<RelativeLayout
android:id="@+id/RelativeLayout10"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="5dp">
<ImageView
android:id="@+id/ImageView06"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/profile_icon_gray_color"/>
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/ImageView06"
android:layout_marginBottom="15dp"
android:layout_marginLeft="18dp"
android:layout_marginTop="30dp"
android:layout_toRightOf="@+id/ImageView06"
android:background="#ffffff"
android:gravity="left"
android:ems="10"
android:hint="Write and share what you have in Mind "
android:textSize="15dp"
android:typeface="serif">
</EditText>
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout15"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/RelativeLayout10"
android:layout_alignRight="@+id/RelativeLayout10"
android:layout_below="@+id/TextView20"
android:layout_marginTop="15dp"
android:background="@drawable/layout_style_white_bg">
</RelativeLayout>
<TextView
android:id="@+id/TextView20"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/RelativeLayout10"
android:layout_alignRight="@+id/RelativeLayout10"
android:layout_below="@+id/RelativeLayout10"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView21"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/RelativeLayout15"
android:layout_alignRight="@+id/RelativeLayout15"
android:layout_below="@+id/RelativeLayout15"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView18"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/TextView21"
android:layout_alignRight="@+id/TextView21"
android:layout_below="@+id/TextView21"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView11"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/TextView18"
android:layout_alignRight="@+id/TextView18"
android:layout_below="@+id/TextView18"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView10"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/RelativeLayout13"
android:layout_alignRight="@+id/RelativeLayout13"
android:layout_below="@+id/RelativeLayout13"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<RelativeLayout
android:id="@+id/RelativeLayout13"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="@+id/RelativeLayout10"
android:background="@drawable/layout_style_white_color_with_dark_bg">
<TextView
android:id="@+id/TextView17"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@drawable/layout_style_dark_bg"
android:gravity="center"
android:onClick="Load_More_Pictures"
android:text=" Publish "
android:textColor="#000000"
android:textSize="12dp"
android:typeface="sans"/>
<ImageView
android:id="@+id/ImageView01"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="50dp"
android:layout_marginTop="5dp"
android:layout_toLeftOf="@+id/TextView17"
android:src="@drawable/camera_icon_gray_color"/>
<ImageView
android:id="@+id/ImageView02"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignBottom="@+id/ImageView01"
android:layout_alignTop="@+id/ImageView01"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_toLeftOf="@+id/ImageView01"
android:src="@drawable/gallery_icon_gray_color"/>
<ImageView
android:id="@+id/ImageView03"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/ImageView02"
android:layout_marginRight="5dp"
android:layout_marginTop="-4dp"
android:layout_toLeftOf="@+id/ImageView02"
android:src="@drawable/video_icon_gray_color"/>
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/RelativeLayout19"
android:layout_marginTop="13dp"
android:gravity="center"
android:text="..."
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff3322"
android:textSize="32dp"/>
<RelativeLayout
android:id="@+id/RelativeLayout19"
android:layout_width="fill_parent"
android:layout_height="400dp"
android:layout_alignLeft="@+id/RelativeLayout14"
android:layout_alignRight="@+id/RelativeLayout14"
android:layout_below="@+id/RelativeLayout14"
android:layout_marginTop="5dp"
android:background="#ffffff">
<RelativeLayout
android:id="@+id/RelativeLayout20"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/TextView26"
android:layout_marginTop="15dp"
android:background="@drawable/layout_style_white_bg">
</RelativeLayout>
<TextView
android:id="@+id/TextView26"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView27"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/RelativeLayout20"
android:layout_alignRight="@+id/RelativeLayout20"
android:layout_below="@+id/RelativeLayout20"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView24"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/TextView27"
android:layout_alignRight="@+id/TextView27"
android:layout_below="@+id/TextView27"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView13"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignLeft="@+id/TextView24"
android:layout_alignRight="@+id/TextView24"
android:layout_below="@+id/TextView24"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView12"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_alignRight="@+id/TextView13"
android:layout_below="@+id/TextView13"
android:layout_marginTop="5dp"
android:background="#595B5C"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#969696"
android:visibility="invisible"/>
<TextView
android:id="@+id/TextView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/TextView12"
android:layout_alignRight="@+id/TextView12"
android:layout_below="@+id/TextView12"
android:layout_marginTop="23dp"
android:gravity="center"
android:text="..."
android:textColor="#000000"/>
<RelativeLayout
android:id="@+id/RelativeLayout17"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/layout_style_white_color_with_dark_bg">
<ImageView
android:id="@+id/ImageView16"
android:layout_width="43dp"
android:layout_height="43dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/setting_icon"/>
<TextView
android:id="@+id/TextView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/ImageView16"
android:text="My Wall & Feeds"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:textStyle="bold"/>
<ImageView
android:id="@+id/ImageView15"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="12dp"
android:layout_marginTop="12dp"
android:src="@drawable/list_icon"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout18"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/layout_style_white_bg">
<TextView
android:id="@+id/TextView22"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="20dp"
android:background="@drawable/layout_style_white_color_with_dark_bg"
android:gravity="center"
android:onClick="Load_More_Pictures"
android:text=" View More "
android:textColor="#e85e75"
android:textSize="12dp"
android:typeface="sans"/>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/TextView22"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/TextView19"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="Loading Feeds"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:typeface="sans"/>
<ProgressBar
android:id="@+id/ProgressBar01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout07"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#ff3322">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="Internet connection problem"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff"
android:textSize="15dp"
android:textStyle="bold"
android:typeface="sans"/>
</RelativeLayout>
</RelativeLayout>
</ScrollView>