MohsenFM
MohsenFM

Reputation: 129

What is the difference between gravity="center" and textAlignment="center" and centralHorizontal="true"

I have a question about Layout Arrangement in Android. Seems to me gravity="center" and textAlignment="center" do the same thing? How about centralHorizontal="true" ?

Upvotes: 2

Views: 2181

Answers (1)

anomeric
anomeric

Reputation: 698

For practicality purposes, textAlignment and gravity are equivalent, except that textAlignment is a member of the View Class and the gravity is a member of TextView class. layout_centerHorizontal defines how a view should be placed in relation to it's parent view, while the former two deal with how the view should lay out it's subviews.

Upvotes: 5

Related Questions