Android Layout Question regading tablerows:

0 Max Meier · September 10, 2015

Hello community,

Being the newbie, please alow me to ask a question :)

Inside a relative layout I have a tablerow (amongst other items), in which I have a button and a textview.

Now the Thing I want to do seems simple if discribed in words:
Inside the tablerow I have two culumns, in the first goes the button, in the second goes the text.
Now I want to allign the Buttons to the left of the tablerow and the text to the right of the tablerow!

How on earth am I gona do that?
I think I tried all the allignment and gravity options there are in the Android Studio, but none showed the result I desire.

Would anyone be so Kind to help me?
Your help is very much apreciated :)
Thanks in advance.

Here is an extract from the main.xml:




Post a Reply


Oldest  Newest  Rating
0 Max Meier · September 11, 2015
Hi Milan,

Thanks alot for the fast reply, awsom!

and my apologies, I thought, if I use the insert code button the forum enging would recognise the lines as code and print it and not treat it as a code ^^ so well never mind.

I almost feared such an answer, so I'll have to reorganice the whole lot of my layouts.
I realy dont know why I could come up with the idea that if there is a tablerow, there might as well be a cell in it ^^

Thanks again, I think your Explanation is clear so I should be ok with it.
 If I mess up again, I'll come back :)
0 Max Meier · September 11, 2015
Thanks alot Milan

I guess your instructions are clear and I'll try that.
If I mess up again I still might come back ;)
+1 Donald Trump · September 10, 2015
use a LinearLayout and give it an orientation property of horizontal. inside it, make two more LinearLayouts.

for the first LinearLayout within the parent one, give it a property of gravity="left" or layout_gravity="left", and inside That layout put the button.
for the second LinearLayout within the parent one, give it a property of gravity="right" or layout_gravity="right", and inside it put the textview.

i've pulled this information from my head, didn't test it, so it may not work, but i'm pretty sure it will.

also, code tags are broken, as you can see, so i suggest you to link me up with your code on
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator