Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6062351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:02:26+00:00 2026-05-23T09:02:26+00:00

What appeared to be a simple requirement is becoming quite a painful process. I

  • 0

What appeared to be a simple requirement is becoming quite a painful process. I need an AppWidget to show some (usually multi-line) text – the text will vary in size, and may be longer than the view allows, so needs ellipsizing in that case. The view will also support resizable widgets in Android v3.1, which again requires that the widget be able to dynamically support content of varying sizes correctly. Easy, you’d think? And if it was a single line TextView, I think it would be…

So initially I created a single TextView, set the properties to ellipsize it when the text doesn’t fit, and came across the bug that means this doesn’t work – the text only wraps across two lines.

I then grabbed an open source custom view that ellipsizes correctly with multiple lines and it works fine, but only in an activity. I forgot that AppWidget limits what Views can go in a widget, so this also fails (“Class not allowed to be inflated”). I see no way to use this custom view.

So… the best solution I can think of is to add a series of single-row TextViews to the widget, and iterate through substrings until I find the length that fits in each row, before moving on to the next. i.e. manually render/measure/render the text. There are many downsides to this approach.

Is there a better way to get multi-line ellipsized text into an AppWidget?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:02:27+00:00Added an answer on May 23, 2026 at 9:02 am

    To be honest, I think you should step back and rethink what you are wanting to do. Being able to resize widgets is really intended for the new kinds of resizable containers, where there is a clearly variable amount of data available and a well-defined way for the widget to express how it should be shown within the container. If you aren’t using those, it is going to be very tricky for you to build a layout that adjusts to provide useful information if the user resizes it significantly.

    The old approach that people would take — of having the app widget available in different cell sizes each with a different layout — probably still make sense for app widgets that are not using the new stack or list UIs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created simple Java class to test file writes from applets: update appeared
I expected this to be simple, but I'm getting some strange results. I'd appreciate
I have a simple awk one liner that folds the next line onto the
I have a simple method: std::vector<string> start() { std::vector<std::string> deletedFiles; // << error appeared
I've created a HTML + PHP simple page with some javascript that provide from
I try to do some simple Ajax call with refresh of page content with
I have some simple page transitions that fade in, once the user has landed.
I'm struggling a bit trying to achieve something that appeared simple initially to me.
The problem appeared to be very simple, but I can not find any solution
I am trying to do something which appeared to be simple...I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.