android 线性布局
2016-03-24 21:12
525 查看
activity_main.xml线性布局
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.hanqi.test6.MainActivity" android:orientation="vertical" android:gravity="center_horizontal" android:padding="16dp" > <!-- orientation改方向 vertical垂直 horizontal水平 gravity内部对齐方式 right居右 center整个屏幕居中 padding 边距 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="账号:" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入用户名"/> <!--hint 提示输入信息--> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="密码:" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入密码" android:password="true" /> <!--password 是否是密码框--> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登陆" android:layout_weight="1" /> <!--layout_weight 权重--> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="注册" android:id="@+id/button2" android:layout_weight="1" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="取消" android:layout_weight="1" /> </LinearLayout> </LinearLayout>
相关文章推荐
- Android手机无法使用google地图的问题的解决方案
- [android] 隐式意图和显式意图的使用场景
- Android开发之ActivityManager获取系统信息
- Android 仿365日历支持左右切换月份上下收缩
- 【Android】6、添加及使用日志工具——LogCat
- Android即时通讯中的表情的定义和使用
- Android 5.0在framework里添加自定义新类
- android中的Touch触摸事件传递机制
- Android中使用AdapterViewFlipper实现自动播放的图库
- android小错误
- android开发之SQLite详解
- Android 中文件类型与MIME的匹配表
- android Listview中设置enable状态,显示点击的item
- Android的Textview里面夹杂图片
- 详细解析 RxAndroid 的使用方式
- Android数据库加密
- Android生成二维码
- Android之Activity框架
- android 分发机制
- Android软键盘的隐藏显示研究