LinearLayout 和 RelativeLayout
共有属性: java代码中通过btn1关联次控件 android:id="@+id/btn1"
控件宽度 android:layout_width="80px" //"80dip"或"80dp"
android:layout_width =“wrap_content”
android:layout_width =“match_parent”
控件高度 android:layout_height="80px" //"80dip"或"80dp"
android:layout_height =“wrap_content”
android:layout_height =“match_parent”
控件排布 android:orientation="horizontal”
android:orientation="vertical“
控件间距 android:layout_marginLeft="5dip" //距离左边
android:layout_marginRight="5dip" //距离右边
android:layout_marginTop="5dip" //距离上面
android:layout_marginRight="5dip" //距离下面
控件显示位置 android:gravity="center" //left,right, top, bottom
android:gravity="center_horizontal"
android:layout_gravity是本元素对父元素的重力方向。
android:layout_gravity属性则设置控件本身相对于父控件的显示位置
android:gravity是本元素所有子元素的重力方向。
android:layout_gravity="center_vertical"
android:layout_gravity="left"
android:layout_gravity="left|bottom"
TextView中文本字体 android:text="@String/text1" //在string.xml中定义text1的值 android:textSize="20sp" android:textColor=”#ff123456”
android:textStyle="bold" //普通(normal), 斜体(italic),粗斜体(bold_italic)
定义控件是否可见 android:visibility=”visible” //可见
android:visibility=”invisible” //不可见,但是在布局中占用的位置还在
android:visibility=”gone” //不可见,完全从布局中消失
定义背景图片 android:background="@drawable/img_bg" //img_bg为drawable下的一张图片
seekbar控件背景图片及最大值
android:progressDrawable="@drawable/seekbar_img"
android:thumb="@drawable/thumb"
android:max = "60"
仅在RelativeLayout中有效: 在父亲布局的相对位置 android:layout_alignParentLeft="true" //在布局左边 android:layout_alignParentRight="true" //在布局右边 android:layout_alignParentTop="true" //在布局上面 android:layout_alignParentBottom="true " //在布局的下面
在某个控件的相对位置 android:layout_toRightOf="@id/button1" //在控件button1的右边,不仅仅是紧靠着 android:layout_toLeftOf="@id/button1" //在控件button2的左边,不仅仅是紧靠着
android:layout_below="@id/button1 " //在控件button1下面,不仅仅是正下方
android:layout_above=“@id/button1” //在控件button1下面,不仅仅是正下方
定义和某控件对奇 android:layout_alignTop=”@id/button1” //和控件button1上对齐
android:layout_alignBottom=”@id/button1” //和控件button1下对齐
android:layout_alignLeft=”@id/button1” //和控件button1左对齐
android:layout_alignRight=”@id/button1” //和控件button2右对齐
android:layout_centerHorizontal="true" //水平居中 a
ndroid:layout_centerVertical="true"
android:layout_centerInParent="true"
仅在LinearLayout中有效 设置控件在一排或一列中所占比例值
android:layout_weight="1"
设置Listview获取焦点时图片显示,默认为橙色,想去掉换成无色图片即可
android:listSelector="@drawable/nocolor"
listview设置分割线
android:divider="#000"
android:dividerHeight="1px"
android:drawSelectOnTop="false" 用来设置listview上的背景颜色会不会挡住(覆盖)内容,false表示不覆盖
LinearLayout 和 RelativeLayout的更多相关文章
- LinearLayout和RelativeLayout 区别
LinearLayout和RelativeLayout转自:http://blog.csdn.net/w176236767/article/details/6605848共有属性:java代码中通过b ...
- LinearLayout和RelativeLayout
LinearLayout和RelativeLayout 共有属性:java代码中通过btn1关联次控件android:id="@+id/btn1" 控件宽度android:layo ...
- linearLayout 和 relativeLayout的属性区别(转)
LinearLayout和RelativeLayout 共有属性:java代码中通过btn1关联次控件android:id="@+id/btn1" 控件宽度android:layo ...
- Android开发——LinearLayout和RelativeLayout的性能对比
0. 前言 我们都知道新建一个Android项目自动生成的Xml布局文件的根节点默认是RelativeLayout,这不是IDE默认设置,而是由android-sdk\tools\templates\ ...
- linearLayout 和 relativeLayout的属性区别
LinearLayout和RelativeLayout 共有属性: java代码中通过btn1关联次控件 android:id="@+id/btn1" 控件宽度 android:l ...
- Mono for Android (3)-- AbsoluteLayout、FrameLayout、LinearLayout、RelativeLayout、TableLayout
AbsoluteLayout:允许开发人员将视图放在所定义的位置.该布局已经过时了,建议改用其他 FrameLayout:最简单的布局选项,其设计目的是在屏幕上显示单个对象.所有元素都固定在左上角.如 ...
- Android 系统功能设置菜单 LinearLayout与relativeLayout的实现
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- android LinearLayout和RelativeLayout实现精确布局
先明确几个概念的区别: padding margin:都是边距的含义,关键问题得明白是什么相对什么的边距padding:是控件的内容相对控件的边缘的边距. margin :是控件边缘相对父空间的边距 ...
- 用android LinearLayout和RelativeLayout实现精确布局(转)
先明确几个概念的区别: padding margin都是边距的含义,关键问题得明白是什么相对什么的边距. padding是控件的内容相对控件的边缘的边距. margin是控件边缘相对父控件的边距. a ...
随机推荐
- Xcode Build Setting Reference
https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/ ...
- 【顽固BUG】Visual Studio 2013 + TestDriven.NET-3.8.2860_Personal_Beta 调用的目标发生了异常。
前言 突然怎么弄也无法断点调试了 输出如下: ------ Test started: Assembly: Server5.V2.dll ------ 调用的目标发生了异常. 而且网站运行提示: -- ...
- POJ 3356 AGTC(最小编辑距离)
POJ 3356 AGTC(最小编辑距离) http://poj.org/problem?id=3356 题意: 给出两个字符串x 与 y,当中x的长度为n,y的长度为m,而且m>=n.然后y能 ...
- CentOS6.3(64位)下安装Oracle11gR2(64)服务器
安装环境 Linux服务器:Centos6.3 64位 Oracle服务器:Oracle11gR2 64位 系统要求 1.Linux安装Oracle系统要求 系统要求 说明 内存 必须高于1G的物理内 ...
- 实战:推断mysql中当前用户的连接数-分组筛选
#connets.sh #!/bin/sh #ocpyang@126.com #依据输入參数u或d来显示出相应的username或数据库名中用户的连接数. #也能够输入u 详细username或d 详 ...
- Unity 制作虚拟手柄例子
Unity不愧是收费开发软件,有写好的Joystick(虚拟手柄),使用起来很简单,我们一起来学习一下哈!! 本文源代码Win版的 :http://vdisk.weibo.com/s/BDn59yfn ...
- SUN-LDAP6.3_RHEL 5.0-卸载LDAP
卸载LDAP 1.注销服务器 到目录/ldap/ldapinstance/dscc6/bin下 # ./dsccreg remove-server -h 主机名 /ldap/ldapinstance/ ...
- Aspose.Words导出dt到word的问题
已解决:单挑数据导入到一个word文档,导出文字和图片成功,执行Main();方法导出dt到word 待解决:多条数据(文字,图片的导入到一个word文档里面)从dt导入到word;已发现的错误提示“ ...
- list类型for遍历
package cn.stat.p9.map.demo; import java.util.ArrayList; public class Listfor { /** * @param args */ ...
- UVA10090 数论基础 exgcd
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...