Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextView with Background and centered text [closed]

I want to create a TextView which has a custom background. In particular I would like to have a Text view which looks like this. I know that i can set a background to a TextView with android:background="@drawable/displaybackground but how can i align the text in this textview. The text should be displayed in the center of the Textview, like in the image above.

kind regards

like image 281
Moonlit Avatar asked Sep 13 '13 13:09

Moonlit


Video Answer


1 Answers

Use center for the gravity property in the TextView (not the layout_gravity).

like image 196
M.Sameer Avatar answered Sep 16 '22 17:09

M.Sameer