简体   繁体   中英

Textview not wrapping text

I used all possible ways to wrap text in textview but it's not working. It's only showing one line and the rest is gone. I'm fetching address from database and assigning it to textview . I tried textview 's height and width parameters with all possible values but it's still not working.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="fill_horizontal">
<TextView android:layout_toRightOf="@+id/address" 
    android:layout_alignTop="@+id/address" android:layout_alignBottom="@+id/address" 
    android:layout_height="wrap_content"
    android:id="@+id/addressans" 
    android:layout_marginLeft="55dp"
    android:inputType="textMultiLine"
    android:layout_weight="1"
    android:ellipsize="none"
    android:singleLine = "false"
    android:layout_width="wrap_content">
</TextView>
</RelativeLayout>

That's coz you specified both android:layout_alignTop="@+id/address" and android:layout_alignBottom="@+id/address" . Your TextView has no space to stretch. You probably need to remove android:layout_alignBottom="@+id/address" attribute to let it stretch to the bottom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM