+1
Є відповідь

How can you have 2 variable length text strings display side by side

jakelisby 11 років тому оновлено dwalruff 11 років тому 4
I have 2 text strings that are variable width and I want them to display butted against each other (no overlap) and have them centered in a panel. So no matter if one side is shorter than the other, they are always centered. The reason there's 2 text elements is I need to have one variable text element be bold where the other is not. In HTML I would use something like a tag. Is there a way to do this in Wire? I added an image example although I have this concept frequently through our app.

You could probably just wrap your two text elements in a panel and center that panel inside of the other panel that you want it to display in. You can use fitwidth on this new panel to make sure it is always the exact width of all its children combined.
You could put an empty panel that is only a few pixels wide with no background color centered in your container and give it an alias. You could then use leftof and rightof to position around it.
Thanks guys for the help. A couple clarifying issues...

So the one issue that rules out Dustin's option is that I don't necessarily want the split between the 2 variables to be the center. I'd like the holistic text (both variables together) to be centered.

So I thought Ian's route would work, but it seems like fitwidth need to have absolute widths set on the children text elements. Since I'm not sure on the width, I'm not sure how to handle that.

Any further thoughts?
If this is purely for displaying information and has no actions triggered by tapping the text you could use a texttemplate. In wire there is no concept of an inline element like a span or b tag, everything is block. Basically you would turn it into html then you could write some css to style it. This will not work if you need this to be a button because you cannot put an onclickup, onclick, etc because the web view will not know how to distinguish a link or another tap. Although you could put another panel over the web view that has the onclickup if needed.