I created a simple java function to truncate a string that will appear in my list view. I am showing a news headline and below this roundup. I would like to have the same behavior as the image below. I am currently trimming a news headline with 45 characters and then adding a “...” at the end. However, when I change the orientation to the landscape, the name may appear without truncation. I do not think that the application below trims the news headline, but saves the headline in one line and automatically "trims".

How can I achieve this behavior in my application?
source
share