lukus
lukus

Reputation: 1

Android layout using tables

I'm making an application in android that has a table; which seemed to be a good idea at first but I've now ran into a couple of problems.

I want all columns to be of equal width dispite how much content I have put in it (text view). I thought stretch /shrink column may have handled that issue but it doesnt; I guess I missread something. Is there any way to clip the text to stop it from making all the columns all different sizes?

I know I can clip the text myself to something i know will fit, but it would be nice if I could throw any length of type in there and know it's only going to take up 1/7th of the width.

My other issue is that I want my height to be equal to my width (so i get a square), but the width changes to the orientation of my view (landscape /portait) and is obviously dependant on the actual screen size too.

I've done everything in xml so far.

any help much appreciated

Upvotes: 0

Views: 149

Answers (1)

Cheryl Simon
Cheryl Simon

Reputation: 46844

It might help if you posted your current xml, so we could see what you are doing.

That said, I'm not sure that a table layout will give you the flexibility that you want. I.e:

If the child is a TableRow, then the height is always WRAP_CONTENT.

That's going to make it hard for you to make the objects square..

You might look at using a GridView. The items in a GridView should all be the same size. See Hello GridView.

Upvotes: 1

Related Questions