How do I center text horizontally and vertical in a TextView in Android? So that it appears exactly in the middle of the screen.
views:
11326answers:
4
+27
A:
I'm assuming you're using XML layout.
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:text="@string/**yourtextstring**"
/>
Bill
2009-01-11 01:53:17
A:
hi how to move image dynamically in android
Refer me an option
Thnks in advance
Hello Sudhindra,That is how you answer a question. To ask your own question click the "Ask Question" button.
J. Pablo Fernández
2009-06-26 16:35:20
+7
A:
You can also set it up dynamically using:
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
zeevb
2009-11-21 12:25:56