Mitchell
Mitchell

Reputation: 929

Centering Text In A TextView

I have a TextView that has text Dynamically Added to it. My problem is that when I use gravity for the centering the text, it doesn't move because the width is set to "wrap_content".

What should I do to resolve this issue?

Upvotes: 1

Views: 1858

Answers (2)

Chris Simpson
Chris Simpson

Reputation: 7990

I know the answer has already been accepted here but you could have also set the layout_gravity to center too and then wrap_content would still work.

Upvotes: 1

Mark B
Mark B

Reputation: 200501

You're going to have to set the width to something other than "wrap_content".

Upvotes: 2

Related Questions