Reputation: 3538
I have a large graphic, and below it, I want two links, one positioned so that its left edge aligns with the left side of the graphic, and the other positions so that its right edge aligns with the right side of the graphic.
So far, using a horizontal linear layout resized to the width of the graphic, I have:
How do I make it so that the two links are at opposite ends of the linear layout instead of squashed together in the middle? I'd prefer not just to put a 'large' spacer in the middle, because I don't know how wide the screen might be (and hence the graphic which is 85% of the screen width). Is there a way to accurately pin the links to either side?
Many thanks!
Upvotes: 2
Views: 881
Reputation: 3538
Answering my own question here.
Add the following between the two textviews:
<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
The weight
parameter of 1 tells android that this element should get all available spare space.
Upvotes: 3