安卓前端布局Android,Android开发的几种常见布局
目前正在从事iOS开发,对于安卓就是大学的时候自学了点,做过几个小的项目,软件外包大赛、计算机设计大赛、移动应用大赛都拿过奖项,呵呵。。。现在回想起来以前大学做的安卓比赛是多么的幼稚。 从现在开始我要从头一步一步回顾安卓,作为一个前端开发工程师要崛起了。。。。哈哈。。。请大家支持的我创作,多提提宝贵的意见。
步入正题!!!!!!!
关于Android的几种常见的布局其实很简单的,是一个入门的关键。主要的线性布局(所有的ui控件都是 以一条线 线性的 方式去 排列的)、相对布局(所有的控件 都是 以相对的位置去放置)、其次表格布局、帧布局(就是页面的叠加,播放器里经常用到)、绝对布局(已废弃)。
关于布局就是xml文件里写。可能有人会说那些标签太多不好记,没问题,不会的可以去控件里拖拽,时间长了子让会记住了。我就拿例子来说吧。
线性布局写的一个小米计算器
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:text="C"
android:textColor="#FFC928"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="DEL"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="÷"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="×"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:text="7"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="8"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="9"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="—"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:text="4"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="5"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="6"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="+"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_width="0dip"
android:layout_weight="3"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:text="1"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="2"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="3"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:text="0"
android:layout_width="0dip"
android:layout_weight="2"
android:layout_height="wrap_content"/>
android:text="."
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
android:text="="
android:background="#F07A23"
android:layout_width="0dip"
android:layout_weight="1"
android:gravity="bottom|right"
android:layout_height="fill_parent"/>
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ToggleButton" />
线性布局与相对布局混合使用做一个设置界面
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#113965"
android:orientation="vertical"
tools:context=".MainActivity" >
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="自动旋转屏幕"
android:textColor="#ffffff" />
android:id="@+id/cbx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#ff0000" />
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:visibility="visible" />
网格布局做的类似qq的登入页面
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:text="请输入QQ"
android:layout_width="0dip"
android:layout_weight="2"
android:layout_height="wrap_content"/>
android:layout_width="0dip"
android:layout_weight="5"
android:layout_height="wrap_content"/>
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:text="请输入QQ密码"
android:layout_width="0dip"
android:layout_weight="2"
android:layout_height="wrap_content"/>
android:layout_width="0dip"
android:layout_weight="5"
android:layout_height="wrap_content"/>
android:text="登入"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
绝对布局做的类似游戏鼠标的界面
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:id="@+id/middle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="中间" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/middle"
android:layout_centerHorizontal="true"
android:text="上" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/middle"
android:layout_centerHorizontal="true"
android:text="下" />
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/middle"
android:text="左" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/middle"
android:text="右" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="左上角" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="14dp"
android:text="左下角" />
帧布局
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:text=""
android:background="#ff0000"
android:layout_width="200dip"
android:layout_height="200dip"/>
android:text=""
android:background="#00ff00"
android:layout_width="100dip"
android:layout_height="100dip"/>
android:text=""
android:background="#0000ff"
android:layout_width="50dip"
android:layout_height="50dip"/>
安卓前端布局Android,Android开发的几种常见布局相关推荐
- Android软件开发之盘点界面五大布局(十六)
Android软件开发之盘点界面五大布局 雨松MOMO原创文章如转载,请注明:转载至我的独立域名博客雨松MOMO程序研究院,原文地址:http://www.xuanyusong.com/archive ...
- java简述常见的布局极其特点_请简要说明 Android 中五种常见布局的特点。_学小易找答案...
[简答题]请简要说明有序广播和无序广播的区别 [简答题]请简要说明 Android 程序结构中 AndroidManifest.xml 的功能? [简答题]简述李村站人工办理进路的作业过程. [简答题 ...
- [阿里Hao]Android无线开发的几种经常使用技术
本文由阿里巴巴移动安全client.YunOS资深project师Hao(嵌入式企鹅圈原创团队成员)撰写,是Hao在嵌入式企鹅圈发表的第一篇原创文章.对Android无线开发的几种经常使用技术进行综述 ...
- 【Android 应用开发】AndroidUI设计之 布局管理器 - 详细解析布局实现
写完博客的总结 : 以前没有弄清楚的概念清晰化 父容器与本容器属性 : android_layout...属性是本容器的属性, 定义在这个布局管理器的LayoutParams内部类中, 每个布局管理器 ...
- Android App 开发的三种姿势 ~
点击上方"码农的后花园",选择"星标" 公众号 精选文章,第一时间送达 现在市场上各式各样的App越来越多,其实设计一个App也没有那么难,这期就讲解一下安卓开 ...
- [Android Studio]掌握Android Studio的五种常见控件和五种常见布局
目录 一.View和ViewGroup 二.Android的五种常见控件 2.1 文本控件 2.1.1 TextView 2.1.2 EditText 2.2 按钮控件 2.2.1 Button 2. ...
- Android 第七课 4种基本布局之FrameLayout和百分比布局
FrameLayout(帧布局),她没有方便的定位方式,所有的控件都会默认摆放在布局的左上角. 修改activity_main.xml中的代码,如下: <?xml version="1 ...
- Android 第六课 4种基本布局之LinearLayout和Relativelayout
看完控件,紧接着看布局,布局是可以来放置控件,管理控件的.布局里也可以嵌套布局. 我们新建项目UILayoutTest项目,活动名和布局名选择默认.加入活动及其对应的布局已经创建完成. 线性布局(Li ...
- 【测试开发】几种常见的自动化测试框架
几种常见的自动化测试框架 在软件测试领域,自动化测试框架有很多,这里主要介绍几种常用的自动化测试框架. 1.pytest pytest 是 Python 的一种单元测试框架,与 Python 自带的 ...
最新文章
- Citrix Xendesktop中VDA注册DDC的流程
- UVa LA 4253 UVa 1421 Archery 枚举,状态削减,oj错误题目 难度: 1
- Linus:“我删除了Linux,因为它就是个垃圾!”
- Dash的快速入门将使您在5分钟内进入“ Hello World”
- MongoDB高级——聚合
- cuSPARSE库:(十四)求解稀疏三角形线性系统(solution of sparse triangular linear systems)
- UISegmentedControl判断点击第几项
- python黑客攻防入门mobi_《Flink入门与实战》配套资源
- OpenContrail 体系
- 技术变化太快,程序员咋办? 从Adobe Flash想到那些年我幸运躲过的MFC和塞班
- 【论文笔记】Deep Learning on Graphs: A Survey
- win10修复tcp驱动服务器,怎么解决tcpip.sys文件导致蓝屏|Win10的tcpip修复工具
- 使用地点云实现企业官网中的门店地图
- 【技术探索】利用m3u8下载ts并合并成一个完整视频
- table固定首行首列
- 单片机项目:8个发光二极管从上至下间隔一秒流动,其中每个管亮500ms,500ms,亮时蜂鸣器响,灭时蜂鸣器关闭,一直重复下去
- 关于type_info与typeid
- SSL证书生成全过程
- 过滤器与拦截器的区别?
- 前端性能优化指北-关于有些细节和思路