Android 为什么我的“发送”按钮总是与编辑文本重叠?
我有一个滚动视图,里面有一个相对的布局。当我将相对布局高度设置为匹配父级时,它会将此设置为图形布局,我不知道它为什么会这样做---下图-- 以下是activity_main.xml文件:Android 为什么我的“发送”按钮总是与编辑文本重叠?,android,eclipse,android-layout,Android,Eclipse,Android Layout,我有一个滚动视图,里面有一个相对的布局。当我将相对布局高度设置为匹配父级时,它会将此设置为图形布局,我不知道它为什么会这样做---下图-- 以下是activity_main.xml文件: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="matc
<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>
我还尝试将滚动视图的宽度和高度设置为“填充父对象”,但它仍然执行相同的操作。我做错了什么
提前谢谢你 试试这个
<Button
android:id="@+id/send"
android:layout_width="match_parent"
android:layout_height="125dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_below="@+id/yourEdt"
android:text="Send" />
您尚未指定按钮的正确位置 将
android:layout_down=“@+id/etAdd”
添加到您的按钮中
<Button
android:id="@+id/send"
android:layout_width="match_parent"
android:layout_height="125dp"
android:layout_below="@+id/etAdd"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Send" />
谢谢你的建议,不幸的是它仍然不起作用。你提到你的按钮高度为125dp,它必须根据125dp对齐你的底部,以便在编辑文本中重叠谢谢。它只是缺少了android的布局部分:下面。因此,当您在下面键入android:layout_时,它可以工作。是否有任何默认大小可用于避免该错误?您可以在文本中使用wrap_内容,如果使用,则它将根据您的文本来包装高度:)感谢您的建议,不幸的是,它仍然无法工作。我很困惑,没关系。我离题了。我错过了它的布局部分。谢谢你,善良的陌生人