我宁愿向下打破一切成布局彼此之内。这里将是您需要的一个例子,但有很多方法可以定义完全相同的东西。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/icon" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:layout_centerHorizontal="true"
android:layout_alignBottom="@+id/imageView1"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="200dp"
android:layout_height="50dp"
android:src="@drawable/icon"
android:layout_marginTop="50dp"
android:layout_gravity="center"/>
</LinearLayout>
谢谢!在你的帮助下找出它。看起来我得手动键入边距和大小,因为他们的编辑器只是简单地吹... ... BTW:爱这个社区减少我的线程<3 – user1255410 2012-07-17 19:56:57
雅拖放的想法是伟大的,但实际使用非常令人沮丧。我通常会在屏幕上放下几个项目,然后从代码一侧完全重做屏幕。线性布局可能非常有限,但相对布局会增加大量的定制。尝试在布局中输入“android:”,然后让它坐在一个分钟和拇指的列表中,你可以看到所有相关布局添加的可能性。如果你使用的是我不知道其他编辑器的eclipse。 – 2012-07-17 20:05:18