Select to view content in your preferred language

Callout not adding scrollbars

2242
10
Jump to solution
05-02-2012 10:32 AM
deleted-user-ATjHIWsdQYmT
Deactivated User
I have a callout which contains a RelativeLayout with several rows.  According to the API documentation the Callout expands up to 150 pixels max, THEN adds scrollbars to view the rest of the content.  http://help.arcgis.com/en/arcgismobile/10.0/apis/android/api/com/esri/android/map/Callout.html

Well, My content is much taller than 150 pixels and I'm not getting any scrollbars.  Anybody experience the same issue? 

Hhttp://help.arcgis.com/en/arcgismobile/10.0/apis/android/api/com/esri/android/map/Callout.htmlere is the XML for my RelativeLayout:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical">  <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content" android:id="@+id/coLocation"   android:textSize="14dip" android:textColor="#FF000000"   android:paddingBottom="5dip" android:textStyle="bold"/>  <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content"    android:id="@+id/coPIN" android:layout_below="@id/coLocation"   android:textSize="12dip" android:textColor="#FF000000"/>   <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content"    android:id="@+id/coOwner" android:layout_below="@id/coPIN"   android:textSize="12dip"  android:textColor="#FF000000" android:singleLine="false"/>   <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content"    android:id="@+id/coClass" android:layout_below="@id/coOwner"   android:textSize="12dip" android:textColor="#FF000000"/>   <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content"    android:id="@+id/coDistrict"  android:layout_below="@id/coClass"   android:textSize="12dip" android:textColor="#FF000000" android:singleLine="false"/>   <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content"    android:id="@+id/coAcreage" android:layout_below="@id/coDistrict"   android:textSize="12dip" android:textColor="#FF000000"/>   <TextView android:layout_height="wrap_content"   android:layout_width="wrap_content"    android:id="@+id/coZone" android:layout_below="@id/coAcreage"   android:textSize="12dip" android:textColor="#FF000000"/> </RelativeLayout>
0 Kudos
1 Solution

Accepted Solutions
SimonKlein
Regular Contributor
If you really have a lot of information I would maybe recommend also from an design and usabilty point of view to show only a snippet of the information in the callout and the rest in an AlertDialog or a new Activity. You could handle this with eather a button in the callout or a onclicklistener on the textview. IMHO: If you put a lot of info in the callout without scrolling it looks quite ugly because of the size the callout has. On my phone it almost takes the whole screen. And if the callout is smaller and is scrollable it can be a little exhausting to fiddle with the small scrollable area for some users.

For the second question.

Maybe this helps http://stackoverflow.com/questions/4152726/how-to-wrap-text-to-next-line-in-android-textview.
Or I guess you could also set the maxwidth of the textview to width of the callout.

View solution in original post

0 Kudos
10 Replies
SimonKlein
Regular Contributor
I'm having the same issue on my phone and on my tablet. I haven also tried it with adding a scrollview to the layout but it still doesn't scroll.
I get the normal logcat output such as
05-03 10:45:41.080: D/BounceScrollRunnableDefault(5613): run(), TimeFraction=0.36, mBounceExtent=-1.28849
on my galaxy tab like when I scroll somewhere else.
0 Kudos
SimonKlein
Regular Contributor
I just changed the max height and width of the callout now. Still no scrolling but at least I can show all my data.
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
I just changed the max height and width of the callout now. Still no scrolling but at least I can show all my data.


I was able to change the height of the callout as well but I have quite a bit of information that I want to display.  Scrolling will be helpful when displaying it.  I'm not sure how to get around this or find a solution.

Another problem I have is that long strings of text do not wrap to a second line in the callout.  Have you experienced this, or do you know a way to fix it?
0 Kudos
SimonKlein
Regular Contributor
If you really have a lot of information I would maybe recommend also from an design and usabilty point of view to show only a snippet of the information in the callout and the rest in an AlertDialog or a new Activity. You could handle this with eather a button in the callout or a onclicklistener on the textview. IMHO: If you put a lot of info in the callout without scrolling it looks quite ugly because of the size the callout has. On my phone it almost takes the whole screen. And if the callout is smaller and is scrollable it can be a little exhausting to fiddle with the small scrollable area for some users.

For the second question.

Maybe this helps http://stackoverflow.com/questions/4152726/how-to-wrap-text-to-next-line-in-android-textview.
Or I guess you could also set the maxwidth of the textview to width of the callout.
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
Simon,

Thanks for the suggestions.  I was able to get the text to wrap and created a link for "more info" as opposed to scrolling a gigantic amount of information.  The issue I'm now having is that when I rotate my device (portrait to landscape) the text wrapping disappears.  Also, I have a small "close" button in the upper right corner.  When I rotate to Landscape, it disappears.  When I rotate back to portrait, it comes back.  I've attached some screen shots.

Any ideas?!
0 Kudos
SimonKlein
Regular Contributor
It seems, that the layout in the callout gets bigger then the max size of the callout again. Because the text is not wrapped they button is also in the not visible area on the right side.

Do you have different layouts for portrait and landscape?
What do you do on the orientation change? Do you just "capture" them in the manifest like this android:configChanges="keyboardHidden|orientation|screenLayout|screenSize" or do you handle it yourself in the app.

My guess would be somehow the layout in the callout thinks its has more space in landscape so it doesn't wrap the text and so also pushes the button out of the callouts visible area.

Btw: Don't forget to take care of this http://forums.arcgis.com/threads/57101-Exception-with-Callout-on-map-after-returning-from-showing-an... with your callouts.
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
I am using the same layout for both portrait and landscape.  I didn't think it was necessary to create different layouts for each orientation. I am capturing the orientation change in the manifest.  Does it make a difference where you capture the orientation (other than being able to handle the maxwidth of the TextView(s)?)

I checked out the link you posted but I'm not sure what I should do.  Your thread is pointing out a bug, but I don't see what to do. Am I missing something?

Thanks for your help.  BTW - I am new to both Java and the Android API.  I'm a "transforming" .NET developer.
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
I am using the same layout for both portrait and landscape.  I didn't think it was necessary to create different layouts for each orientation. I am capturing the orientation change in the manifest.  Does it make a difference where you capture the orientation (other than being able to handle the maxwidth of the TextView(s)?)<br><br>I checked out the link you posted but I'm not sure what I should do.  Your thread is pointing out a bug, but I don't see what to do. Am I missing something?<br><br>Thanks for your help.  BTW - I am new to both Java and the Android API.  I'm a "transforming" .NET developer.  
0 Kudos
SimonKlein
Regular Contributor
I checked out the link you posted but I'm not sure what I should do.  Your thread is pointing out a bug, but I don't see what to do. Am I missing something?

I'm dismissing callouts atm to work around this bug. Just wanted you to be aware of this, so you don't wonder if it happens to you too. 🙂


If you capture the orientationchange in the manifest the activity does nothing and just redraws everything in landscape. If you would listen to the orientationchange in the activity you would have to take care about saving the maps state, alertdialogs, running threads, etc.. But you don't do it this way, so it shouln't be an issue.

I tested orientationchanges with my callout and it works ether way, so I'm not sure where the issue is here.
I noticed, that the callout can be a little picky in which order you set the content, heigt/width and style.
For me, in this order it works. For you too hopefully.
Callout callout = mMapView.getCallout();
    callout.setStyle(R.xml.calloutstyle_searchresult);
    callout.setContent(mCalloutView);
    callout.setCoordinates(addressPoint);
    callout.setMaxHeight(400);
    callout.setMaxWidth(500);
    callout.show();
0 Kudos