设置TextView水平居中显示

时间:2016-05-10 23:09:23   收藏:0   阅读:84

1、让TextView里的内容水平居中

 android:gravity="center_horizontal"

2、让TextView控件在它的父布局里水平居中

 android:layout_gravity="center_horizontal"

 3、文本布局示例

   <EditText 
        android:id="@+id/factorOne"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
    <EditText 
        android:id="@+id/factorTwo"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/sym"/>
    <TextView
        android:id="@+id/sym"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/factorOne"/>        
    <Button 
        android:id="@+id/cal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/factorTwo"/>

Copyright © 吴华锦
雅致寓于高阁渔舟唱晚,古典悠然
格调外发园林绿树萦绕,馥郁清香

原文:http://www.cnblogs.com/hanqing/p/3633706.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!