Surely this is a frequent usecase but I can't seem to resolve it with a LinearLayout (or RelativeLayout) but maybe i'm missing something.
Best explained with an image:
I have a basic textview chatbubble with another textview aligned to the right (the timestamp for the message).
If you use a
LinearLayout widget with horizontal
orientation and one of its children wants to take all the available horizontal space then you should use layout weight.
For the first
For the second
In this case you say that second
TextView will take as much horizontal space as needed and the first
TextView will take the rest. "0dp" is just an optimization to prevent extra layout measure calls.