-1
我想在鍵盤向上時將佈局滾動到底部。我寫了下面的代碼,但我不明白爲什麼它不工作。任何人都可以告訴我該代碼的錯誤。當鍵盤向上時佈局不滾動
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#FFFCE8"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/top"
android:layout_height="50dp"
android:background="#82552e"
android:layout_width="fill_parent"
android:layout_alignParentTop="true"
>
<TextView
android:text="Add Text"
android:textColor="#ffffff"
android:textSize="20dp"
android:typeface="serif"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
<ScrollView
android:layout_below="@+id/top"
android:layout_above="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
>
<EditText
android:id="@+id/edit"
android:gravity="top"
android:layout_width="fill_parent"
android:layout_height="150dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
>
<Button
android:id="@+id/add"
android:text="Add"
android:textSize="18dp"
android:typeface="serif"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="@drawable/item_back"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
在此先感謝。
請參閱本http://stackoverflow.com/a/10793505/2520370 – Steve