Android开发_1.布局
来源:互联网 发布:mac怎么建立文件夹 编辑:程序博客网 时间:2024/05/20 15:37
1.常见布局
- 1.1 线性布局 LinearLayout
右键–>创建Android XML File
根节点:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"//宽度,填充父框体 android:layout_height="wrap_content"//高度,包裹内容 android:gravity="center_horizontal" //里边控件的分布,水平居中 android:orientation="horizontal" >//排列方式:水平、垂直 <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" android:inputType="textPersonName" > <requestFocus /> </EditText></LinearLayout>
1.2 相对布局
RelativeLayout1.3 绝对布局
2.控件
- 2.1 图片
<ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/ic_launcher"/><!-- 图片路径 -->
- 2.2 文本控件
<TextView android:inputType="textPassword" <!-- 输入内容分类,密码、数字(number)、电话号码(phone)等等 --> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" />
- 2.3 复选框
<CheckBox android:layout_width="match_parent" android:layout_height="wrap_content"/> 方法: isChecked() //判断是否被选中,选中为true
阅读全文
0 0
- Android开发_1.布局
- 【android开发】弹出对话框_1
- 【android开发】图片滑动_1
- 自动布局_1
- 【android开发】列表控件(ListView)的使用_1
- Android开发初级00_1有关intent的知识点
- android 开发之布局
- Android开发--布局LinearLayOut
- Android开发布局
- android开发之布局
- Android 开发 布局技术
- Android开发 布局
- Android开发 布局优化
- Android开发布局属性
- Android 开发实战 布局
- Android开发-UI布局
- Unity 插件开发_1
- Ionic开发入门教程_1
- 获取json中data的数据
- Linux source命令
- 什么是虚拟内存?虚拟内存的优缺点?
- react native学习笔记21——常用API(3)Geolocation定位、Keyboard键盘
- Revit api 获取文档内所有对象根列表
- Android开发_1.布局
- linux 安装mysql
- Git clone指定分支
- 在tomcat里面,怎么修改jsp都没有变化
- 论文笔记之目标检测(2)-- GRP-DSOD
- [ Lucas定理 数位DP 容斥 ] 「2015 计蒜之道 复赛」360的产品试用体验
- android、ios、php之间AES加密解密
- java的hashMap的resize()
- Centos 7由于下载软件包信息失败,软件包选择被禁止