【发布时间】:2011-07-04 05:34:36
【问题描述】:
我有一个运行良好的布局(使用 TableLayout 等...)。看起来像这样: http://i.stack.imgur.com/jLFhA.png
我想用一个RelativeLayout重写它:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="6dip">
<TextView android:id="@+id/textViewTopicTitle"
android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Title" android:background="#880000"></TextView>
<TextView android:id="@+id/textViewSolution"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textViewTopicTitle" android:text="Description...." android:background="#008800"></TextView>
<Button android:text="Start" android:id="@+id/buttonTopic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/textViewSolution" android:layout_below="@id/textViewTopicTitle"
android:layout_marginRight="6dip">
</Button>
</RelativeLayout>
这是不正确的,因为绿色的 TextView 没有填充尽可能多的空间。
所以我改变: android:id="@+id/textViewSolution" android:layout_width="fill_parent"
但在这种情况下,按钮不见了!
http://i.stack.imgur.com/ugzeq.png
我的问题是:是否可以仅使用 RelativeLayout 创建这样的布局?
【问题讨论】:
标签: android