Domanda

Text that does not fit into the width cropped. Can I get the text to wrap to the next line in syllables?

Another TextView wraps lines. I suspect that there is no transfer because the TextView is inside TableRow

Style.xml

<style name="ContactTextView">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textSize">14sp</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:layout_margin">5dp</item>
    <item name="android:background">@drawable/textview_border</item>
    <item name="android:singleLine">false</item>
</style>

Contact_view.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@color/back_black" >

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:stretchColumns="1" >

        <TableRow
            android:id="@+id/nameTableRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/nameLabelTextView"
                style="@style/ContactLabelTextView"
                android:text="@string/label_name" >
            </TextView>

            <TextView
                android:id="@+id/nameTV"
                style="@style/ContactTextView" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/phoneTableRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/phoneLabelTextView"
                style="@style/ContactLabelTextView"
                android:text="@string/label_phone" >
            </TextView>

            <TextView
                android:id="@+id/phoneTV"
                style="@style/ContactTextView" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/birthdayTableRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/birthdayLabTV"
                style="@style/ContactLabelTextView"
                android:text="@string/date_birthday" >
            </TextView>

            <TextView
                android:id="@+id/birthdayTV"
                style="@style/ContactTextView" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/passportTableRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/passportLabTV"
                style="@style/ContactLabelTextView"
                android:text="@string/passport_min" >
            </TextView>

            <TextView
                android:id="@+id/passportTV"
                style="@style/ContactTextView" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/adressTableRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/adressLabTV"
                style="@style/ContactLabelTextView"
                android:text="@string/label_city" >
            </TextView>

            <TextView
                android:id="@+id/adressTV"
                style="@style/ContactTextView" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/siteTableRow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/siteLabTV"
                style="@style/ContactLabelTextView"
                android:text="@string/site_min" >
            </TextView>

            <TextView
                android:id="@+id/siteTV"
                style="@style/ContactTextView" >
            </TextView>
        </TableRow>
    </TableLayout>

</ScrollView>
È stato utile?

Soluzione

Everything was decided simply by adding the line android:shrinkColumns="1" in TableLayout

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top