Android - 常见的控件布局,左中右,左右等
这里汇总的是自己在工作过程中,使用过的常见空间布局,记录在这里。详情如下:
1. 三个控件,分别处于左,中,右
要点:使用RelativeLayout
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_alignParentLeft="true"/>
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_centerHorizontal="true"/>
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_alignParentRight="true"/>
- </RelativeLayout>
2. 两个控件,分别处于左右
要点:使用layout_weight="1"的TextView撑开中间,将两个控件挤到两边
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_gravity="center"/>
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_gravity="center"/>
- </LinearLayout>
持续更新......
Android - 常见的控件布局,左中右,左右等的更多相关文章
- Android常见的控件
1.Log类的使用 (1)Log.v() v是verbose 提醒的意思 (2)Log.d() d是debug调试 (3)Log.i() i是info信息的意思 (4)Log.w() ...
- Android入门(六):Android控件布局属性全解
第一类:属性值为true或falseandroid:layout_centerHrizontal 水平居中 (Hrizontal表示水平)android:layout_centerVertical 垂 ...
- Android 控件布局常用属性
<!--单个控件经常用到android:id —— 为控件指定相应的IDandroid:text —— 指定控件当中显示的文字,需要注意的是,这里尽量使用strings.xml文件当中的字符串a ...
- Android:控件布局(相对布局)RelativeLayout(转)
相对布局常用属性: 子类控件相对子类控件:值是另外一个控件的id android:layout_above----------位于给定DI控件之上android:layout_below ------ ...
- Android 控件布局常用的属性
<!--单个控件经常用到android:id —— 为控件指定相应的IDandroid:text —— 指定控件当中显示的文字,需要注意的是,这里尽量使用strings.xml文件当中的字符串a ...
- Android:控件布局(线性布局)LinearLayout
LinearLayout是线性布局控件:要么横向排布,要么竖向排布 决定性属性:必须有的! android:orientation:vertical (垂直方向) .horizontal(水平方向) ...
- 【风马一族_Android】第4章Android常用基本控件
第4章Android常用基本控件 控件是Android用户界面中的一个个组成元素,在介绍它们之前,读者必须了解所有控件的父类View(视图),它好比一个盛放控件的容器. 4.1View类概述 对于一个 ...
- [Android] Android 卡片式控件CardView的优雅使用
[Android] Android 卡片式控件CardView的优雅使用 CardView是在安卓5.0提出的卡片式控件 其具体用法如下: 1.在app/build.gradle 文件中添加 comp ...
- Android自己定义控件系列案例【五】
案例效果: 案例分析: 在开发银行相关client的时候或者开发在线支付相关client的时候常常要求用户绑定银行卡,当中银行卡号一般须要空格分隔显示.最常见的就是每4位数以空格进行分隔.以方便用户实 ...
随机推荐
- C#WinForm POST方式提交给网页(与网页交互) (转)
提交(POST): 需要导入命名空间: using System.Net;using System.IO; string postData = "username=" + Logi ...
- kuangbin专题十六 KMP&&扩展KMP HDU1686 Oulipo
The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e ...
- git基础命令整理
首先安装git,然后选择一个文件夹做初始化!! yum -y install git ### 安装 git init ...
- ubuntu下vnc部署安装
ubuntu下vnc部署安装,参考如下博客:https://www.cnblogs.com/xuliangxing/p/7642650.html https://jingyan.baidu.com/a ...
- CF D. Fair(思维+DFS)
http://codeforces.com/contest/987/problem/D 题目大概: 给出一个n个城镇m条边的图,给出每个城镇拥有的特产(可能多个城镇有相同特产).有k种不同特产. 要求 ...
- vue.js学习笔记(二)——vue-router详解
vue-router详解 原文链接:www.jianshu.com 一.前言 要学习vue-router就要先知道这里的路由是什么?为什么我们不能像原来一样直接用<a></a> ...
- day27 粘包及粘包的解决方案
1. 粘包现象 先了解一个词MTU MTU是Maximum Transmission Unit的缩写.意思是网络上传送的最大数据包.MTU的单位是字节. 大部分网络设备的MTU都是1500个字节, ...
- 面向对象之-------------------永不停机的ATM
import os class Account: def __init__(self, username, password, money=0): self.username = username s ...
- 搭建 flask 应用
参考文档:http://docs.jinkan.org/docs/flask/quickstart.html#a-minimal-application 1.使用Pycharm创建Flask应用 fr ...
- win7旗舰版+caffe+vs2013+matlab2014b(无GPU版)
参考网站: http://www.cnblogs.com/njust-ycc/p/5776286.html 无法找到gpu/mxGPUArray.h: No such file or director ...