Android

center GUI-elements using the example of TextView



A GUI-element can be simply centered through the parameter „gravity“ in the definding XML-file:

<TextView  
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent" 
   android:gravity="center_horizontal|center_vertical"
   android:text="Zentrierter Text"
/>

It is important to combine the centering with „fill_parent“.


Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007