What\'s wrong with my code, I\'m trying to display my TextView named \"invalid\", in different locations (left,right,center), but the gravity (left,right,center) w
\"invalid\"
You set this text view a width of "wrap_content" it means, what ever the text is, the view take the size of the text.
and in the LinearLayout , the default gravity (used here) is 'center'
LinearLayout
you should try this :