我如何在水平和垂直居中的文本在的TextView
在Android中,使其恰好出现在的的TextView ?
How do I center the text horizontally and vertically in a TextView
in Android, so that it appears exactly in the middle of the TextView
?
我在你使用XML布局假设。
I'm assuming you're using XML layout.
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text="@string/**yourtextstring**"
/>
和作为@stealthcopter评论
在Java中: .setGravity(Gravity.CENTER);
and as @stealthcopter commented
in java: .setGravity(Gravity.CENTER);
上一篇:Android的XML布局参数不按预期不按、布局、参数、Android
下一篇:我如何设置IntelliJ IDEA的Android应用程序?应用程序、如何设置、IntelliJ、IDEA