设置TextView水平居中显示


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 ©  吴华锦
雅致寓于高阁渔舟唱晚,古典悠然
格调外发园林绿树萦绕,馥郁清香


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM