Android studio学习笔记3
Android studio学习笔记3
RelativeLayout常见属性
相对于父元素给控件布局
android:layout_centerHrizontal 若为ture水平居中
android:layout_centerVertical 若为ture垂直居中
android:layout_centerInparent 相对于父元素完全居中
android:layout_alignParentBottom 位于父元素的下边缘
android:layout_alignParentLeft 位于父元素的左边缘
android:layout_alignParentRight 位于父元素的右边缘
android:layout_alignParentTop 位于父元素的上边缘
android:layout_alignWithParentIfMissing 如果对应的兄弟元素找不到的话就以父元素做参照物属性值必须为id的引用名“@id/id-name”
android:layout_below 位于元素的下方
android:layout_above 位于元素的的上方
android:layout_toLeftOf 位于元素的左边
android:layout_toRightOf 位于元素的右边android:layout_alignTop 该元素的上边缘和某元素的的上边缘对齐
android:layout_alignLeft 该元素的左边缘和某元素的的左边缘对齐
android:layout_alignBottom 该元素的下边缘和某元素的的下边缘对齐
android:layout_alignRight 该元素的右边缘和某元素的的右边缘对齐给属性赋予像素值
android:layout_marginBottom 底边缘的距离
android:layout_marginLeft 左边缘的距离
android:layout_marginRight 右边缘的距离
android:layout_marginTop 上边缘的距离
代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" //设置了为线性布局
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" //对局为垂直对齐
android:background="#00aff0" //设置背景色,用取色器
tools:context=".MainActivity">
<RelativeLayout //采用相对布局
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">
<Button
android:textColor="@android:color/white"
android:id="@+id/bt_ms_account"
android:background="@drawable/bg_blue"
android:layout_alignParentBottom="true"
android:text="MS账号"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/bt_sk_account"
android:textColor="@android:color/white"
android:layout_marginBottom="20dp"
android:layout_above="@id/bt_ms_account"
android:background="@drawable/bg_blue"
android:text="skype用户"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/im_count"
android:layout_centerHorizontal="true"
android:layout_marginBottom="0dp"
android:layout_above="@id/bt_ms_account"
android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:layout_marginTop="20dp"
android:layout_marginLeft="80dp"
android:layout_marginRight="80dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_weight="1"
android:src="@drawable/windows"
android:layout_width="0dp"
android:layout_height="22dp" />
<ImageView
android:layout_weight="1"
android:src="@drawable/mail"
android:layout_width="0dp"
android:layout_height="22dp" />
<ImageView
android:layout_weight="1"
android:src="@drawable/skype"
android:layout_width="0dp"
android:layout_height="22dp" />
<ImageView
android:layout_weight="1"
android:src="@drawable/xbox"
android:layout_width="0dp"
android:layout_height="22dp" />
<ImageView
android:layout_weight="1"
android:src="@drawable/cloud"
android:layout_width="0dp"
android:layout_height="22dp" />
</LinearLayout>
<TextView
android:id="@+id/tv_count"
android:textColor="@android:color/white"
android:background="#00a3de"
android:padding="15dp"
android:layout_alignParentBottom="true"
android:textSize="20dp"
android:text="创建账号"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_login"
android:textColor="@android:color/white"
android:gravity="center"
android:layout_marginBottom="25dp"
android:layout_above="@id/tv_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登录"/>
</RelativeLayout>
</LinearLayout>
Android studio学习笔记3的更多相关文章
- Android Studio 学习笔记(一)环境搭建、文件目录等相关说明
Android Studio 学习笔记(一)环境搭建.文件目录等相关说明 引入 对APP开发而言,Android和iOS是两大主流开发平台,其中区别在于 Android用java语言,用Android ...
- Android Studio学习笔记
转:http://stormzhang.com/devtools/2014/11/25/android-studio-tutorial1 背景 相信大家对Android Studio已经不陌生了,An ...
- Android Studio 学习笔记(1)
最近从Eclipse转到Android Studio IDE,很多东西需要学习,本文是个记录. 项目结构 在Anroid Studio 中,一个Project 包括多个Module,每个Module下 ...
- Android Studio 学习笔记1.1 创建自己的第一个安卓项目并且打包APK
自从上一次安装完安卓开发工具Android Studio后抽时间看视屏尝试编写自己的第一个安卓项目约两周的时间 每天下班后会花上1~2小时的时间去学习 目前的成果如下:次元宅的我.apk 嘛 总而 ...
- Android Studio 学习笔记(二):布局简介和xmlns说明
初学Android Studio,是在b站看的教程视频,这里的笔记也是以其为基础的,个人强烈安利: [天哥]Android开发视频教程最新版 Android Studio开发 Android 布局简介 ...
- Android Studio 学习笔记(四):Adapter和RecyclerView说明
在现版本中,滚动控件有多种,而相比于ListView,GridView,RecyclerView的用途更广,因此将前两者作为Adapter适配器的引入,再对RecyclerView进行简单讲解. MV ...
- Android Studio 学习笔记(三):简单控件及实例
控件.组件.插件概念区分 说到控件,就不得不区分一些概念. 控件(Control):编程中用到的部件 组件(Component):软件的组成部分 插件(plugin): 应用程序中已经预留接口的组件 ...
- Android Studio 学习笔记(五):WebView 简单说明
Android中一个用于网页显示的控件,实际上,也可以看做一个功能最小化的浏览器,看起来类似于在微信中打开网页链接的页面.WebView主要用于在app应用中方便地访问远程网页或本地html资源.同时 ...
- Git for Android Studio 学习笔记
http://learngitbranching.js.org/ 一个特别好的git学习教程 创建一个project,然后导入github
- Android自动化学习笔记:编写MonkeyRunner脚本的几种方式
---------------------------------------------------------------------------------------------------- ...
随机推荐
- python进阶之路17 包的使用、collections、time、random模块
包 大白话: 多个py文件的集合>>>:文件夹 专业:内部含有__init__.py文件的文件夹(python2 必须要求 python3无所谓) 包的具体使用 虽然python3对 ...
- 02-Sed语法介绍
1 Sed语法介绍 介绍Sed支持的基本命令及其命令行语法,Sed可以通过以下两种形式进行调用: 学习sed命令使用之前,需要掌握正则表达式的用法. sed [-n] [-e] 'commands' ...
- 轻松解决 CSS 代码都在一行的问题
前言 最近在做博客园的界面美化,用的是博客园[guangzan]的开源项目,配置超级简单,只需要复制粘贴代码就好啦. 但在粘贴 CSS 代码时遇到一个问题,那就是所有代码都挤在了一行,没有一点排板的样 ...
- (14)go-micro微服务服务层Handle开发
目录 一 Handle层开发功能说明 需要完成的服务开发功能: 从哪找需要开发的功能 二 代码编写 三 最后 一 Handle层开发功能说明 需要完成的服务开发功能: 登录 注册 查询用户信息 修改信 ...
- 让 MSYS2 Bash 像 Git Bash 一样显示 Git 分支名称
Git for Windows 的 Bash 有一个很实用的功能,如果当前目录处于 Git 仓库中,那么命令行中会显示当前 Git 分支的名称(见下图). 然而原版的 MSYS2 Bash 没有这个功 ...
- Python 内置界面开发框架 Tkinter入门篇 丙(文末有福利彩蛋,今天可是元宵节)
以下内容为本人的学习笔记,如需要转载,请声明原文链接微信公众号「ENG八戒」https://mp.weixin.qq.com/s/B1hH5Qzd2RkAiiUId1tLWw 本文大概 2874 个字 ...
- Django框架之drf:9、接口文档,coreapi的使用,JWT原理、介绍、快速使用、定制、认证
目录 Django框架之drf 一.接口文档 二.CoreAPI文档生成器 1.使用方法 三.JWT 1.JWT原理及介绍 2.JWP快速使用 3.定制返回格式 4.JTW的认证类 Django框架之 ...
- 带你动手做AI版的垃圾分类
摘要:本案例将使用YOLOX模型,实现一个简单的垃圾分类应用. 本文分享自华为云社区<ModelBox社区案例 - 使用YOLOX做垃圾分类>,作者:HWCloudAI. 1 ModelB ...
- Dijkstra求最短路 I(朴素算法)
这道题目又是一个新算法,名叫Dijkstra 主要思路是:输入+dist和vis初始化(都初始化为0x3f)+输入g(邻接矩阵)+Dijkstra函数 Dijkstra函数:先将dist[ ...
- P4_创建第一个小程序项目
设置外观和代理 创建小程序项目 点击"加号"按钮 填写项目信息 项目创建完成 在模拟器上查看项目效果 在真机上预览项目效果 主界面的 5 个组成部分