androidlistviewlayoutrowandroid-relativelayout

Proper way to divide into 4 pieces an android layout


what I want to achieve is, divide the rows layout described in picture below. what should I do to achieve dividing the row into 3 exactly same size and 1 unknown size? X are same size and i dont know and dont want to specify if its not necessary...

EDIT: buttons are on the left , center, and right.


Solution

  • Use a LinearLayout inside a RelativeLayout. Put 3 items inside the LinearLayout and give them the same weight. Put the unknown item to the right of the LinearLayout with the help of RelativeLayout.

    Left elements will align themselves according to the right-one's width. Here's the code: https://gist.github.com/3772838