android - Multiline TextView with line breaks wrapping -


i'm trying create custom infocontents template google maps pin , i'm running in weird behavior when comes wrapping multiline textview contains text multiple line breaks when using following code:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:paddingbottom="4dp"     android:paddingtop="4dp"     android:orientation="vertical">   <imageview       android:id="@+id/officeimage"       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:layout_gravity="top|center_horizontal"       android:scaletype="centerinside"       android:adjustviewbounds="true"       android:maxwidth="175dp"/>   <textview         android:layout_margintop="10dp"         android:id="@+id/infowindowtitle"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:text="sunshine coast"         android:textcolor="@android:color/black"         android:textstyle="bold"/>   <textview       android:id="@+id/infowindowsubtitle"       android:layout_width="match_parent"       android:layout_height="wrap_content"       android:singleline="false"       android:textsize="10dp"       android:text="level 3, 2 emporio place\n2 maroochy blvd, maroochydore qld 4558\npo box 5800, maroochydore bc qld 4558"       android:maxlines="10"       android:textcolor="@android:color/black"/> </linearlayout> 

result:

result

as shown in image text after first wrapped line missing. if there no wrapped lines, or last line wrapped line, lines shown (see image below). know how work properly?

expected result

muhammad babar's suggestion fixes issue. added relativelayout parent of linearlayout , text shown (see below working code).

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="wrap_content"     android:layout_height="wrap_content">   <linearlayout     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:paddingbottom="4dp"     android:paddingtop="4dp"     android:orientation="vertical">     <imageview         android:id="@+id/officeimage"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="top|center_horizontal"         android:scaletype="centerinside"         android:adjustviewbounds="true"         android:maxwidth="175dp"/>     <textview           android:layout_margintop="10dp"           android:id="@+id/infowindowtitle"           android:layout_width="match_parent"           android:layout_height="wrap_content"           android:text="sunshine coast"           android:textcolor="@android:color/black"           android:textstyle="bold"/>     <textview         android:id="@+id/infowindowsubtitle"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:textsize="10dp"         android:text="level 3, 2 emporio place\n2 maroochy blvd, maroochydore qld 4558\npo box 5800, maroochydore bc qld 4558"         android:maxlines="10"         android:textcolor="@android:color/black"/>   </linearlayout> </relativelayout> 

Comments

Popular posts from this blog

php - isset function not working properly -

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -