【发布时间】:2012-07-13 17:00:08
【问题描述】:
下面是我创建带有标题“在此处输入电话号码”的文本框的 xml 代码。我有一个编辑框,它可以获取电话号码和一个按钮。 问题是文本框和编辑框相互重叠。如何解决这个问题。
<RelativeLayout 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" >
<TextView android:id="@+id/textLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Enter number to dial"
/>
<EditText android:id="@+id/phoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
/>
<Button android:id="@+id/callButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Show Dialer"
/>
</RelativeLayout>
【问题讨论】:
-
如果您的应用面向 API 级别 8+,您还应该始终使用 match_parent 而不是 fill_parent。 Fill_parent 在 API 级别 8 中重命名为 match_parent。认为两者在功能上相同,match_parent 现在是标准。