Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How can I do the equivalent of "float: right" with vertical centering using layouts?

$
0
0

Let's say I have three views, left, middle and right, and I want to align them as this

layout

If I use a StackLayout, I can't align the right element to the right. Even if I set its XAlign = TextAlignment.End it doesn't get aligned to the right. I've tried setting explicit HeightRequest on the layout, but that doesn't seem to affect this. On the other hand, StackLayout allows me to set YAlign = TextAlignment.Center to align them vertically.

If I use a RelativeLayout, I can set the first view as Constraint.Constant(0), middle view as Constraint.RelativeToView(rating, (l, m) => m.Bounds.Width + 10), and the right view as Constraint.RelativeToParent(p => p.Bounds.Width - right.Width), but I can't align them vertically anymore.

I'm not really sure how would I do this using AbsoluteLayout without resorting to math using the display width.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>