Automatically truncate TextView text so as not to overlap another TextView

Y©R

New Member
I have a \[code\]ListView\[/code\] that displays a bunch of homework assignments. The \[code\]ListView\[/code\] items use a \[code\]FrameLayout\[/code\] to position two \[code\]TextViews\[/code\]. The first \[code\]TextView\[/code\] is aligned to the left, and the second is aligned to the right. (Both are aligned in the center vertically.) The first displays a snippet of the assignment description, and the second displays the due date.What I want to do is make it so that the due date takes up as much space as it needs and the description fills up the remaining space, like so:|----------------------------------------------------|
| Read pgs 15-35, update tim... Fri, May 4|
|----------------------------------------------------|Right now the description text will continue on to overlap the date. It will truncate at the end of the line though.Is there anyway I can do this in XML, or do I have to do it in code by shortening the string before I set the \[code\]TextView\[/code\] value (presumably in my \[code\]getView\[/code\] call)? If I did it in code, I'd have to calculate the amount of horizontal space the strings would take up figure out how short the description needs to be. That seems like it could get messy...Any other suggestions on how to accomplish this are greatly appreciated!
 
Back
Top