【发布时间】:2012-10-07 01:58:41
【问题描述】:
在我在 Eclipse 中的图形布局中,EditView、TextView 和按钮是我想要的位置。但是当我在手机上运行它们时,它们会被移动到不同的位置。有人可以帮我把它们放在我希望它们放在哪里吗?
这是我的代码:
<?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:background="@drawable/backgroundhdpi" >
<EditText
android:id="@+id/bill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="100dp"
android:ems="10"
android:inputType="phone"
android:text="Enter Your Bill"
android:textSize="18dip" />
<Button
android:id="@+id/calculateTip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/bill"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_marginLeft="15dp"
android:text="Calculate" />
<TextView
android:id="@+id/tipOwed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/bill"
android:layout_centerHorizontal="true"
android:layout_marginBottom="123dp"
android:scrollHorizontally="false"
android:text="Time to Tip!"
android:textColor="#2c6f37"
android:textSize="35dip"
android:textStyle="bold" />
</RelativeLayout>
【问题讨论】:
-
您需要发布您的布局代码。此外,如果您在布局编辑器中使用不同的设备主题进行设计,如果您的手机具有不同的屏幕尺寸/密度,它在您的手机上看起来会有所不同。
-
可能是您希望它的外观和实际外观的屏幕截图。
-
@user1657178 请同时添加截图。
标签: android android-layout button textview android-edittext