How to layout view right aligned and bottom of an LinearLayout

前端 未结 3 2304
离开以前
离开以前 2021-02-20 16:13

I am trying to layout 1 textview (upText) left aligned and 1 textview (downText) and an image view (image) both on the same line and right aligned.

how can I do that? I

3条回答
  •  时光取名叫无心
    2021-02-20 16:41

    I realize this post is a bit old but just in case someone comes across this in their search for clarity;

    The parent linear layout is where gravity needs to be specified for the child to align with the desired behavior which is why the above posts are explaining that linear layout is not possible for two separate behaviors to occur since a child cannot decide where to align itself within a linear layout.

    
    
    
    

    It should also be said that the parent linear layout must have a defined size and not be wrap-content or this will not work since wrap content implies that there will be no extra space in the layout for positioning, so at least 'match-parent' for width and height is necessary as well as having a parent with a greater size than wrap-content for the child linear layout itself.

    Hope this helps.

提交回复
热议问题