Here is a short question about how best to handle text truncation. Do you know a good way to show the full string to the user when it gets cut off by a TextView?
Any size screen might chop the text of a long string set in a TextView. The problem becomes more noticeable when an app is supporting multiple sizes, specifically normal and large size screens.
One good suggestion is to make the text view scrollable. My problem with that suggestion is that I have planned swipe navigation interactions in all four directions and that complicates the text view scroll. I raised this question in Android Office hours today. Any suggestions, especially those based on existing solutions, would be welcome. Thanks in advance…
One way to hande the problem was to add a property to the textview that will make it scrollable without adding code:
This was suggested by a member of the Android Dev Relations team during office hours. However, when tested, scroll was not working on Android version 2.2.2. My new solution is to declare the textview clickable and use the onClick callback to open a dialog.
So now I ellipsize the text (no more scroll tags) to give the user a clear indication that the text got cut off. Here is the xml:
and here is the showDef method:
I like this solution better than simple scrolling in the case where the view group containing the textview has a fixed size. I hope it works for you, too,.