I created a simple java function to truncate a string to be displayed in my list view. I am displaying a news title and below this a news summary. I would like to have the same behavior as the image below. Currently, i am truncating the news title with 45 chars and then appending "..." at the end of it. However, when I change the orientation to landscape, the title could appear without being truncated. I dont think the app below truncates the news title, but it keeps the title in a single line and automatically "truncates".
How can I achieve this behavior in my app?
I don't think you need to truncate title manually. Android TextView component has ellipsize attribute that will do that for you. That also should adopt to any screen orientation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With