视图/小部件不包装

时间:2011-12-03 22:09:10

标签: android android-layout android-widget

我将切换到追逐并将我的所有xml粘贴到下面的特定活动中。我遇到的问题是小部件没有包装,而且大部分文本都在屏幕的右边缘流下。

由于我正在使用“wrap_content”作为宽度,我不明白为什么会发生这种情况。

<?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" >

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView
            android:id="@+id/textViewSendLocWhenItChanges"
            android:text="Send My Pterodactyl When It Changes"
            android:textAppearance="?android:attr/textAppearanceLarge" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <CheckBox
            android:id="@+id/checkBoxSendToSelectedDuckbilledPlatypiWhenPterodactylChanges"
            android:text="Send My Pterodactyl to Selected Duckbilled Platypi When It Changes" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <Button
            android:id="@+id/buttonSendOnPterodactylChangedToSelected"
            android:layout_weight="1"
            android:text="Select Recipients From Contacts" />

        <TextView android:layout_weight="1" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView
            android:layout_span="1"
            android:layout_weight="1"
            android:text="Send Pterodactyl to selected Duckbilled Platypi from Contact List when my Pterodactyl changes by more than the following number of miles:"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <EditText
            android:id="@+id/editTextMilesBeforeNotification"
            android:layout_width="200px"
            android:layout_span="1"
            android:layout_weight="1" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView android:layout_height="10px" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView android:layout_height="20px" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView
            android:id="@+id/textViewBuildStringOfWhoReceivesChangeOfPterodactylUpdates"
            android:layout_width="wrap_content"
            android:text="Your Pterodactyl will be immediately sent to "
            android:textAppearance="?android:attr/textAppearanceSmall" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView android:layout_height="40px" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <Button
            android:id="@+id/buttonNext"
            android:layout_weight="1"
            android:text="Save and Exit Keep In Touch Configuration" />

        <TextView
            android:layout_weight="1" />
    </TableRow>

</TableLayout>

1 个答案:

答案 0 :(得分:1)

layout_width不适用于TableRows。当您有一列跨越两列时,请使用layout_span。尝试使用android:shrinkColumns。希望它有所帮助。