Android Question noob: programmatically style Label (homescreen widget)

Ted K

Member
Licensed User
Longtime User
Hi all,

Probably a stupid or "you can't do that" questions... but here goes.

Say I'm making and Android Homescreen Widget.
The layout has a container (panel) and inside the panel a Label

On the Service update I set the value of the label, something like...

rv.SetText("lblMsg", "red, blue, green, bold, italics, underline, size10, size40")

Is there a way to actually format the colors, style/decoration, and size inline on a single View (Label) in the above text so that "red" is actually red, "blue" is actually blue, so on and so forth?

Or is it strictly one style per View?
If it is strictly one style per View, what would be the best solution for this:

1.) Widget can only contain ultra simple views like Label, Button, Panel
2.) Widget is a 4x4 size (so it's big enough)
3.) Widget calls JSON API and gets a bunch of sales data
4.) Right now I'm just parsing the JSON over a FOR NEXT and string concat'ing the data onto the label
5.) Widget shows something like this:

Title of Widget (separate label view)
(below is the single Label view string concat from the JSON)
Sales Agent Bob: 10 total sales
6x of this type of sale
4x of that type of sale
Sales Agent Joe: 6 total sales
2x of this type of sale
4x of that type of sale

And I want to display the information something like this:

Title of Widget

Sales Agent Bob: 10 total sales (bold added)

6x of this type of sale (color changed)
4x of that type of sale

Sales Agent Joe: 6 total sales
2x of this type of sale
4x of that type of sale



One more stupid question.... is it possible to make a 4x1 sized widget with B4A's RemoteViews, have the contents within the widget actually be 4x(X) tall and the user can vertically scroll through with their finger directly on the widget? Kind of a B4A equiv of CSS' overflow-y: scroll; height: 50px; Or necessary to just launch an activity to show a larger area?

Thanks a million! LOVE LOVE LOVE B4A!!!!
 
Last edited:
Top