【问题标题】:Views/Widgets are not wrapping视图/小部件不包装
【发布时间】:2011-12-03 22:09:10
【问题描述】:

我将切入正题并将我的所有 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>

【问题讨论】:

    标签: android android-layout android-widget


    【解决方案1】:

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

    【讨论】:

    猜你喜欢
    • 2021-04-12
    • 2019-01-13
    • 1970-01-01
    • 2011-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-11
    相关资源
    最近更新 更多