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脚本的几种方式
		---------------------------------------------------------------------------------------------------- ... 
随机推荐
- 《Kubernetes Operator 开发进阶》- 作者絮絮叨
			目录 今天聊啥 本书读者 推荐序 推荐序1 - 邓洪超 推荐序2 - 任晶磊 推荐语 推荐语1 - 张磊 推荐语2 - 宋净超 推荐语3 - 王泽锋 推荐语4 - 周鹏飞 推荐语5 - 郑东旭 本书简 ... 
- 牛客小白月赛65ABCD(E)
			比赛链接:牛客小白月赛65_ACM/NOI/CSP/CCPC/ICPC算法编程高难度练习赛_牛客竞赛OJ (nowcoder.com) A:牛牛去购物 题意 ... 
- 【Redis 技术探索】「数据迁移实战」手把手教你如何实现在线 + 离线模式进行迁移Redis数据实战指南(离线同步数据)
			离线迁移 与在线迁移相比,离线迁移适宜于源实例与目标实例的网络无法连通的场景,或者源端实例部署在其他云厂商Redis服务中,无法实现在线迁移. 存在的问题 由于生产环境的各种原因,我们需要对现有服务器 ... 
- MSIC总结取证分析——日志分析
			MSIC总结取证分析 一.日志分析: 1.常见日志分析类型: 2.常见一些考点: (1)还原特定IP攻击手段(SQL注入.暴力破解.命令执行等),或还原最初攻击时间: (2)寻找flag或者特定文件解 ... 
- [WPF]鼠标移动到Button颜色改变效果设置
			代码 <Style x:Key="Button_Menu" TargetType="{x:Type Button}"> <Setter Pro ... 
- 浅谈LCA问题(最近公共祖先)(四种做法)
			[模板]最近公共祖先(LCA) \(update \ 2023.1.3\) 新增了树链剖分 题目描述 如题,给定一棵有根多叉树,请求出指定两个点直接最近的公共祖先. 输入格式 第一行包含三个正整数 \ ... 
- Keil 5(Keil C51)安装与注册 [ 图文教程 ]
			前言 Keil C51 是 51 系列兼容单片机 C 语言软件开发系统,支持 8051 微控制器体系结构的 Keil 开发工具,适合每个阶段的开发人员,不管是专业的应用工程师,还是刚学习嵌入式软件开发 ... 
- 玩转web3第一篇——web3-react
			概况 web3-react是由Noah Zinsmeister开发的一个web3框架,主要功能是实时获取DApp里的关键数据(如用户当前连接的地址.网络.余额等). Noah也是著名的去中心化交易所u ... 
- 【数据结构和算法】Trie树简介及应用详解
			作者:京东物流 马瑞 1 什么是Trie树 1.1 Trie树的概念 Trie树,即字典树,又称单词查找树或键树,是一种树形结构,典型应用是用于统计,排序和保存大量的字符串(但不仅限于字符串),所以经 ... 
- 11月18日内容总结——同步、异步与阻塞、非阻塞的概念、创建进程的多种方式及multiprocessing模块、进程间的数据隔离和IPC机制(队列)、生产者消费者模型、守护进程、僵尸进程、孤儿进程和多进程错乱问题
			目录 一.同步与异步 同步 异步 二.阻塞与非阻塞 阻塞 非阻塞 三.综合使用 1.同步阻塞: 2.同步非阻塞: 3.异步阻塞: 4.异步非阻塞: 四.创建进程的多种方式 进程的创建 multipro ... 
