您的位置:首页 > 移动开发

安卓ApiDemos学习 app/Activity/HelloWorld

2011-10-23 19:36 405 查看
这个程序很简单,只是在xml中布局并显示一个TextView

<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
android:layout_width="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:text="@string/hello_world"/>


android:layout_width="match_parent"
控件宽度: 原来的属性叫fill_parent,后来SDK修改了名字,但是作用不变

android:gravity="center_vertical|center_horizontal"
对齐方式: 垂直,水平居中对齐。

可以使用 | 符号来设置多个属性

效果如下

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: