我有一個相對的佈局裏面的滾動視圖。當我將相對佈局高度設置爲match_parent時,它會將其設置爲圖形佈局,我不知道它爲什麼這樣做。 ---下面的圖片---爲什麼我的發送按鈕與我的編輯文本重疊?
這裏是activity_main.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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:ems="10"
android:hint="First and Last Name"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/etPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/etName"
android:layout_marginTop="14dp"
android:ems="10"
android:hint="Enter Phone #"
android:inputType="phone" />
<EditText
android:id="@+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/etPhone"
android:layout_marginTop="17dp"
android:ems="10"
android:hint="Enter E-mail"
android:inputType="textEmailAddress" />
<EditText
android:id="@+id/etAdd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/etEmail"
android:layout_marginTop="18dp"
android:ems="10"
android:hint="Additional Information"
android:lines="5"
android:inputType="textMultiLine" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/etPhone"
android:layout_alignParentTop="true"
android:gravity="center"
android:text="Contact Form"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="@+id/send"
android:layout_width="match_parent"
android:layout_height="125dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Send" />
</RelativeLayout>
</ScrollView>
我也曾嘗試設置滾動視圖的寬度和高度,以FILL_PARENT,它仍然一樣的東西。我究竟做錯了什麼?
預先感謝您!
感謝您的建議,不幸的是它仍然無法正常工作。我很困惑,哈哈 – OliverTwist
沒關係。我離題了。我錯過了它的佈局部分。謝謝你有點陌生 – OliverTwist