android - Resize height of Infowindow -


i have google map showing current location , place name in infowindow. it's working well, problem when place name long, @ time, whole text not showing in infowindow this. how can resize infowindow? code below:

private class custominfowindowadapter implements googlemap.infowindowadapter {          private view view;          public custominfowindowadapter() {             view = getlayoutinflater().inflate(r.layout.info_window, null);              view.setlayoutparams(new relativelayout.layoutparams(500, relativelayout.layoutparams.wrap_content));         }          @override         public view getinfocontents(marker marker) {              if (checkin.this.marker != null && checkin.this.marker.isinfowindowshown()) {                 checkin.this.marker.hideinfowindow();                 checkin.this.marker.showinfowindow();             }             return null;         }          @override         public view getinfowindow(final marker marker) {             checkin.this.marker = marker;              string url = null, isloaded = "0";              /*if (marker.getid() != null && markers != null && markers.size() > 0) {                 if (markers.get(marker.getid()) != null && markers.get(marker.getid()) != null) {                     url = markers.get(marker.getid());                     isloaded = markers.get(marker.getid() + marker.gettitle());                 }             }*/             final imageview imgaddress = ((imageview) view.findviewbyid(r.id.imgaddress));              final string title = marker.gettitle();              final customtextview txttitle = ((customtextview) view.findviewbyid(r.id.txttitle));             if (title != null) {                 /*txttitle.settext("la brasserie bordelaise");*/                 mprogressdialog.dismiss();                 txttitle.settext(currentplacename);                 txttitle.setonclicklistener(new view.onclicklistener() {                     @override                     public void onclick(view v) {                         toast.maketext(checkin.this, title, toast.length_long).show();                     }                 });             } else {                 txttitle.settext("");             }              return view;         }     } 

my xml below

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:customfont="http://schemas.android.com/apk/res-auto"     android:layout_width="wrap_content"     android:layout_height="wrap_content">       <relativelayout         android:layout_width="wrap_content"         android:layout_height="@dimen/margin_120"         android:layout_centerhorizontal="true"         android:layout_marginleft="@dimen/margin_30"         android:layout_marginright="@dimen/margin_30"         android:background="@drawable/bg_info_window">          <relativelayout             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_margintop="@dimen/margin_5">              <relativelayout                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginbottom="3dp"                 android:layout_marginleft="@dimen/margin_5"                 android:layout_marginright="@dimen/margin_5"                 android:layout_toleftof="@+id/imgaddress">                  <com.widget.customtextview                     android:id="@+id/txttitle"                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:layout_marginleft="5dp"                     android:inputtype="textmultiline"                     android:maxlines="2"                     android:singleline="false"                     android:text="aaaa"                     android:textcolor="@android:color/black"                     android:textsize="@dimen/text_size_16"                     customfont:fonttextstyle="3" />                 <!--android:text="la brasserie bordelaise"-->                   <linearlayout                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_below="@+id/txttitle"                     android:layout_marginleft="@dimen/margin_5"                     android:orientation="horizontal">                      <imageview                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_margintop="@dimen/margin_5"                         android:src="@drawable/ic_person" />                      <com.widget.customtextview                         android:id="@+id/txttotalpeople"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:layout_marginleft="5dp"                         android:inputtype="textmultiline"                         android:singleline="false"                         android:text="aaaa"                         android:textcolor="@color/colordetailgray"                         android:textsize="@dimen/text_size_medium"                         customfont:fonttextstyle="3" />                 </linearlayout>             </relativelayout>              <imageview                 android:id="@+id/imgaddress"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_alignparentright="true"                 android:layout_centervertical="true"                 android:contentdescription="@string/app_name"                 android:padding="@dimen/padding_10"                 android:src="@drawable/ic_right_arrow" />         </relativelayout>     </relativelayout> </relativelayout> 

you have set static width whole layout.

solution 1

change

view.setlayoutparams(new relativelayout.layoutparams(500, relativelayout.layoutparams.wrap_content)); 

to

view.setlayoutparams(new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content)); 

solution 2

make textview multiline setting maxlines 2 or 3 txttitle.setmaxlines(2)


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

python 3.5 - Pyqtgraph string in x tick -