安卓前端布局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"/>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/394710.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《Cocos2D权威指南》——3.9 本章小结

3.9 本章小结 本章对Cocos2D中的几个核心类(CCNode、CCScene、CCLayer、CCSprite)进行了详细介绍,并且通过节点层级图让大家了解到Cocos2D游戏的基本组成;然后介绍了Cocos2D中的单例。通过完善第2章的游戏实例,大家对…

永恒python图片_python 数据词云展示实例(3)- 背景图设置

记录wordcloud库背景图的设置及样板 之前介绍了wordcloud的基本使用wordcloud的基本使用,本文记录一下如何设置背景图。 样图 背景图tim.jpg 生成样图dream.png 样板 from PIL import Image,ImageSequence image Image.open(tim.jpg)#打开背景图 graph np.array(im…

创造的快乐

早上9点半到的图书馆,十点左右才进入状态,上午和下午的一半时间都用来看AMD的GCN架构,看这种官方的文档,和论文一样,只看摘要和图片,没有死磕的精神,很难有收获,结果就是&#xff0c…

python心得-基本概念2

一 编程语言介绍 1.1 机器语言:直接用计算机能理解的二进制指令编写程序,直接控制硬件 1.2 汇编语言:用英文标签取代二进制指令取编写程序,本质也是在直接控制硬件 1.3 高级语言:用人能理解的表达方式去编写程序&#…

初创团队最重要的是什么_我从一家出色的初创公司工作中学到的最重要的教训...

初创团队最重要的是什么by Yan Cui崔燕 我从一家出色的初创公司工作中学到的最重要的教训 (The most important lessons I learned from working at an amazing startup) I recently left Space Ape Games after a wonderful year. I learnt a lot, and worked on some challe…

企业如何杜绝云端数据泄密?

一直以来,云计算所倡导的就是:“我们可以做得更好,更便宜”。云计算带给企业诸多利好,但实施云计算必然会加剧信息泄露风险。当企业打算把所有数据传输云端的时候,首先要考虑的就是数据保护的问题。 使用云服务&#x…

3dmark for android,Android版3DMark首测

听到这个消息估计很多像我一样看腻了3dmark11画面的跑分党及玩家们有些许小失望。 每年的12月影驰都会联合NVIDIA举办盛大的嘉年华,今年在武汉举办的影驰2012电子竞技嘉年华的合作伙伴名单上出现了futumark的身影。Futuremark中国区负责人影驰在当天的平板体验区也提…

HTML 框架

iframe语法: <iframe src"URL"></iframe>该URL指向不同的网页。 Iframe - 设置高度与宽度 height 和 width 属性用来定义iframe标签的高度与宽度。 属性默认以像素为单位, 但是你可以指定其按比例显示 (如&#xff1a;"80%"). 实例 <iframe…

卡方检验python程序_Python从零开始第二章(1)卡方检验(python)

如果我们想确定两个独立分类数据组的统计显着性&#xff0c;会发生什么&#xff1f;这是卡方检验独立性有用的地方。 Chi-Square检验 我们将在1994年查看人口普查数据。具体来说&#xff0c;我们对“性别和“每周工作时间”之间的关系感兴趣。在我们的案例中&#xff0c;每个人…

当使用makemigrations时报错No changes detected

在修改了models.py后&#xff0c;有些用户会喜欢用python manage.py makemigrations生成对应的py代码。 但有时执行python manage.py makemigrations命令&#xff08;也可能人比较皮&#xff0c;把migrations文件夹给删了&#xff09;&#xff0c;会提示"No changes detec…

以下是ECMAScript 2016、2017和2018中所有新增功能的示例

by rajaraodv通过rajaraodv 以下是ECMAScript 2016、2017和2018中所有新增功能的示例 (Here are examples of everything new in ECMAScript 2016, 2017, and 2018) It’s hard to keep track of what’s new in JavaScript (ECMAScript). And it’s even harder to find usef…

win10下markdownpad2显示问题

win10下解决html渲染问题 下载如下文件安装后&#xff0c;亲测可用 http://markdownpad.com/download/awesomium_v1.6.6_sdk_win.exe转载于:https://www.cnblogs.com/liuqidongprogram/p/6049295.html

php原生函数应用

php常见基本的函数 一、字符串函数implode — 将一个一维数组的值转化为字符串 lcfirst — 使一个字符串的第一个字符小写 ltrim — 删除字符串开头的空白字符&#xff08;或其他字符&#xff09; rtrim — 删除字符串末端的空白字符&#xff08;或者其他字符&#xff09; str_…

android 申请usb权限,USB 权限申请流程

USB android授权方式权限的控制分三块&#xff1a;1:USB host端有个线程循环检测系统是否USB设备插拔&#xff0c;如果有就找到申请权限的APP并调用起来2:APP运行后主动申请权限&#xff0c;也就是requestPermission()接口3:APP运行后直接打开USB设备&#xff0c;这时候USB hos…

ai人工智能程序_简单解释:一个AI程序如何掌握Go的古老游戏

ai人工智能程序by Aman Agarwal通过阿曼阿加瓦尔(Aman Agarwal) 简单解释&#xff1a;一个AI程序如何掌握Go的古老游戏 (Explained Simply: How an AI program mastered the ancient game of Go) This is about AlphaGo, Google DeepMind’s Go playing AI that shook the tec…

python提取hbase数据_详解python操作hbase数据的方法介绍

配置 thrift python使用的包 thrift 个人使用的python 编译器是pycharm community edition. 在工程中设置中&#xff0c;找到project interpreter&#xff0c; 在相应的工程下&#xff0c;找到package&#xff0c;然后选择 “” 添加&#xff0c; 搜索 hbase-thrift (Python cl…

工作随记

td自动换行:设置table 的 style"table-layout:fixed;" 然后设置td的 style"word-wrap:break-word;" white-space: nowrap 文本不换行 Intelidea创建好项目之后&#xff0c;右键新建Java class的时候发现没有改选项,在Project Structure设置源码目录 DOM4j中…

qt for android 图片可拉伸,qt实现九宫格布局,图片拉伸

在实现qt播放时&#xff0c;调用的mplayer,由于采用的是自定义绘图&#xff0c;用的是setAttribute(Qt::WA_TranslucentBackground);结果不能正常在上面显示播放画面&#xff0c;在默认皮肤下是没有问题的&#xff0c;决定用九宫格图片拉伸方式(效果如图)附件图片&#xff1a;文…

第一次作业-李纯锐201731084433

作业属于课程 https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass2 作业要求位置 https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass2/homework/2706 我在这个课程的目标是&#xff1a; 认真学习好软件工程原理以及科学的软件项目开发与管理方法&…

定点化_mif文件生成

clc; %全屏清零 clear all; %变量清零 N2^8; %设置ROM深度&#xff08;字变量&#xff09;的变量参数&#xff0c; s_p0:255; …