【发布时间】:2014-02-08 03:55:56
【问题描述】:
我的按钮布局有问题。
我制作了“small, normal, large, xlarge”布局文件夹。
但在某些设备上,按钮仍然混合在一起!
当我使用设备集 eclipse 查看我的布局时,我可以看到问题,但我不知道设备的尺寸是多少。
我的问题是:谁能给我这些设备中的每一个的尺寸,或者我可以为每个设备制作一个布局?
图片中的设备爆炸了
<?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/mainnati"
android:gravity="center_horizontal" >
>
<Button
android:id="@+id/b_info"
android:layout_width="220dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:background="@drawable/info" />
<Button
android:id="@+id/b_pass"
android:layout_width="220dp"
android:layout_height="50dp"
android:layout_alignLeft="@+id/b_comp"
android:layout_below="@+id/b_comp"
android:layout_marginTop="350dp"
android:background="@drawable/pass" />
</RelativeLayout>
【问题讨论】:
-
发布您的布局文件。
-
我添加了布局文件,我使用了很多我知道的硬编码!但责任归咎于以这种方式教我的人。我必须尽快完成这个项目。
-
两件事:我看到两个按钮。第二个在您的代码(b_comp)中不存在的下方并与左侧对齐。所以,我想它应该引用 b_info,而不是
-
“按钮混在一起”到底是什么意思?此外,您谈到了几个(“small, normal, large, xlarge”)布局文件夹,但只显示一个布局 XML。你真的需要 4 种不同的布局吗? (这可能是个坏主意。)首先,试着仔细阅读this。
标签: android android-layout android-button