【发布时间】:2016-07-26 10:06:59
【问题描述】:
如您所见,我正在尝试拉伸文本框,使其位于“NOPE”按钮旁边。我受到列大小和文本框大小的限制,我不知道如何更改。
XML:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/editBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_column="2"
android:onClick="editEvent"
android:text="EDIT" />
<TextView
android:id="@+id/attendingEventInListviewRow"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_column="38"
android:height="30sp"
android:tag="Events2goName"
android:text="Events2go"
android:textColor="#000000"
android:textSize="22sp"
android:textStyle="normal" />
<Button
android:id="@+id/cancel_arrive"
style="?android:attr/buttonStyleSmall"
android:layout_width="130dp"
android:layout_height="36dp"
android:layout_column="37"
android:layout_gravity="right"
android:layout_weight="0.08"
android:onClick="selectCancelArrive"
android:text="Nope" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
</TableRow>
【问题讨论】:
-
你的
TextView大小固定为200dp,也许改成0dp 并在那里添加android:weight="1"? -
按照我说的,
TextView将占据TableRow中的所有剩余空间 -
我尝试将尺寸更改为 250dp(不增加重量),它只是按下了“NOPE”按钮。比我试过你说的,结果是:prntscr.com/bxnmgm
-
那个按钮有layout_weight也有width,试试去掉权重,为什么你把layout_column设为37?