【发布时间】:2013-11-01 13:50:06
【问题描述】:
我正在尝试创建一个与 facebook android 应用程序有点相似的标题。 header 中间应该有一个 header 标题,两边各有一个按钮。
我有标题,但我下面的代码没有显示任何一个按钮。我不确定此信息是否有帮助,但此标题的 TableRow 布局占用了大量高度空间。在我尝试添加按钮之前,它会一直包裹直到标题的高度。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#008000" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/menuButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/HeaderTextView"
android:text="Button" />
<TextView
android:id="@+id/HeaderTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/header"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center"
android:textColor="#FFF"
android:textStyle="italic" />
<Button
android:id="@+id/infoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/HeaderTextView"
android:text="Button" />
</RelativeLayout>
</TableRow>
</TableLayout>
【问题讨论】: