8

How to Wrap Text in a Text Analysis Software

 2 years ago
source link: https://www.codesd.com/item/how-to-wrap-text-in-a-text-analysis-software.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to Wrap Text in a Text Analysis Software

advertisements

I have some problems wrapping text in my application.

Here is my layout :

<GridLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:columnCount="2"
    android:orientation="horizontal"
    android:rowCount="2" >

    <ImageView
        android:id="@+id/img"
        android:layout_width="150dp"
        android:layout_height="225dp"
        android:layout_gravity="left|top"
        android:layout_column="0"
        android:layout_rowSpan="2"
        android:contentDescription="@string/imgdesc" />

    <TextView
        android:id="@+id/tvName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_column="1"
        android:layout_marginLeft="20dp"
        android:layout_row="0"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/tvDescription"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_column="1"
        android:layout_gravity="fill_horizontal"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="10dp"
        android:layout_row="1"/>

</GridLayout>

And here is the result :

df30v.png

As you can see, a part of the text is out the screen and I don't really know how to fix it.


Try to use LinearLayout for your design instead of GridLayout :

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/img"
        android:layout_width="150dp"
        android:layout_height="225dp"
        android:contentDescription="@string/imgdesc"/>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="5dp"
        android:orientation="vertical">
        <TextView
            android:id="@+id/tvName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceLarge" />

        <TextView
            android:id="@+id/tvDescription"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"/>
    </LinearLayout>
</LinearLayout>


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK