【发布时间】:2014-02-20 05:25:53
【问题描述】:
我已经设置了如下布局,它是垂直格式,当我将它更改为水平方向时,它完全搞砸了。
但是当我改变设备的方向时,它变成了这样:
谁能帮我解决这个问题?
以下的XML代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<Button
android:id="@+id/bBackfromInquiry"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/back" />
<Button
android:id="@+id/bSubmit"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@drawable/mail_us" />
<EditText
android:id="@+id/etMailbody"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_above="@+id/bSubmit"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:ems="10"
android:hint="@string/inqhintComments" />
<EditText
android:id="@+id/etPhone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/textView5"
android:layout_alignParentLeft="true"
android:layout_marginBottom="27dp"
android:ems="10"
android:hint="@string/inqhintPhone"
android:inputType="phone" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/bBackfromInquiry"
android:layout_alignBottom="@+id/bBackfromInquiry"
android:layout_marginLeft="17dp"
android:layout_toRightOf="@+id/bBackfromInquiry"
android:text="@string/buttonInquiry"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="@string/inqComments"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/etName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/bBackfromInquiry"
android:ems="10"
android:hint="@string/inqhintName"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/etEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/etName"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="@string/inqhintEmail"
android:inputType="textEmailAddress" />
</RelativeLayout>
【问题讨论】:
-
请发布纵向和横向模式的 xml。
-
XML 文件是相同的,我没有为同一个活动创建不同的 xml,如果可以,请告诉我,但是我要发布现有的 xml,请稍等。
-
发布你的 xml 代码@MananGupta
-
@kaushik - 我已经添加了xml代码,请检查
-
@18446744073709551615 - 我已添加 XML 文件,请查看
标签: android android-relativelayout android-orientation