<!--

    常用属性说明:

     android:id="@+id/button"  为控件指定Id

     android:text="NNNNNNNNNN" 指定控件的显示文本
android:textSize="12pt" 让控件中的文本显示大小
android:singleLine="true" 让控件中显示的文本在一行显示完,显示不了的自动省略
android:gravity="left" 让控件中的内容靠左显示
android:padding="16dp" 让控件中的文本距控件外边框的填充尺寸,可以像CSS里的padding_left... android:background="#ff0000" 控件中的背景颜色 android:width="1060dip" 指定控件的宽度,好像不起作用了
android:height="200dip" 指定控件的高度,好像不起作用了
android:layout_width="200dp" 控件布局宽度,如果是fill_parent 表示水平填充满父控件
android:layout_height="wrap_content" 填充高度;fill_parent表示填满父控件,最好不要。
android:layout_weight="1" 表示与同级控件的布局权重,如果就两个都是1那就是一人一半,数字大的占用的空间多 -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" tools:context=".MainActivity"> <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"> <Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="NNN"
android:width="160dp"
android:height="200dp"
android:background="#ff0000"
android:textSize="12pt"
android:gravity="right"
android:padding="16dp"
android:singleLine="true"
android:layout_weight="1"
android:id="@+id/button" /> <!--
android:singleLine="true" 表示单行显示,显示不完的省略 --> <Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button4"
android:layout_gravity="right"
android:layout_weight="2" /> </LinearLayout> </RelativeLayout>

Android开发中XML布局的常用属性说明的更多相关文章

  1. android开发中常见布局的注意点

    常见布局的注意点 线性布局: 必须有一个布局方向 水平或者垂直 在垂直布局中 只有左对齐 右对齐 水平居中生效 在水平布局中 只有顶部对齐 底部对齐 垂直居中生效 权重:组件按比例分配屏幕的剩余部分( ...

  2. Android开发中常用的设计模式

    首先需要说明的是,这篇博文灵感来自于 http://www.cnblogs.com/qianxudetianxia/archive/2011/07/29/2121547.html ,在这里,博主已经很 ...

  3. Android开发中JavaBean类和序列化知识的理解

    原创文章,转载请注明出处:http://www.cnblogs.com/baipengzhan/p/6296121.html Android开发中,我们经常用到JavaBean类以及序列化的知识,但经 ...

  4. 【Android】安卓开发中的布局与事件

    [Android]安卓开发中的布局与事件 1.Android Studio下载配置 非常简单的百度然后点击下载安装就好了.注意的是,本来我是打算使用评价还不错的Genymotion这个软件来充当虚拟机 ...

  5. Android开发中常用的ListView列表的优化方式ViewHolder

    在Android开发中难免会遇到大量的数据加载到ListView中进行显示, 然后其中最重要的数据传递桥梁Adapter适配器是常用的,随着市场的需 求变化ListView'条目中的内容是越来越多这就 ...

  6. Android源码浅析(四)——我在Android开发中常用到的adb命令,Linux命令,源码编译命令

    Android源码浅析(四)--我在Android开发中常用到的adb命令,Linux命令,源码编译命令 我自己平时开发的时候积累的一些命令,希望对你有所帮助 adb是什么?: adb的全称为Andr ...

  7. Android开发中常用的库总结(持续更新)

    这篇文章用来收集Android开发中常用的库,都是实际使用过的.持续更新... 1.消息提示的小红点 微信,微博消息提示的小红点. 开源库地址:https://github.com/stefanjau ...

  8. Android中TextView和EditView常用属性设置

    Android中TextView和EditView常用属性设置 点击跳转

  9. Android开发-之五大布局

    在html中大家都知道布局是什么意思了,简单来说就是将页面划分模块,比如html中的div.table等.那么Android中也是这样的.Android五大布局让界面更加美化,开发起来也更加方便.当然 ...

随机推荐

  1. 多态(RAW)

    函数重写overwrite:当子类提供了和父类同名的虚函数时,称之为函数重写,函数的返回值类 函数名 参数列表必须完全相同 名字隐藏namehide:当子类提供了和父类同名的数据时 叫名字隐藏 函数重 ...

  2. 基于软件开源实践(FLOSS)论共产主义的可实现性

    好久没发博客,来个狠的,我不信挨踢界有人比我更蛋疼来研究这个. 在马克思提出共产主义100多百年后,软件开发领域中出现了一种特别的生产方式:开源(FLOSS:Free/Libre and Open S ...

  3. jQuery超酷下拉插件6种效果演示

    原始的下拉框很丑啦, 给大家一款jQuery超酷下拉插件6种效果 效果预览 下载地址 实例代码 <div class="container"> <section ...

  4. 你真的知道setTimeout是如何运行的吗

    大家看下如下代码,猜猜执行结果: var start = new Date; setTimeout(function(){ console.log('时间流逝了:'+(new Date - start ...

  5. abap 字符串处理

    1).SHIFT:截断字符串 SHIFT {c} [BY {n} PLACES] [{mode}].:      作用:去掉字符串的前n个位置的字符,如果n未指定,默认为1,如果指定的n小于等于0,则 ...

  6. SharePoint 2010 人员选择器搜索范围的限定

    客户AD中用户信息过多,而当前的SharePoint应用中不需要针对所有AD进行筛选,则需要通过STSADM来设置搜索范围: stsadm -o setsiteuseraccountdirectory ...

  7. 转使用chrome命令行:disable-web-security 实现浏览器跨域

    注意chrome 48 版本后此方法就不能用了 推荐一个新方式来实现本地跨域调试线上资源,搜索chrome插件 Allow-Control-Allow-Origin: *.https://chrome ...

  8. Objective-C 快速入门--基础(一)

    1.实例变量的可见度有哪些?对访问变量有什么影响? 所谓的内部,指的是相应类的@implementation和@end之间 示例: @interface Person : NSObject { @pu ...

  9. 【C语言】C语言static和extern区别

    目录: [static] [extern] 1.static · 定义一个内部函数/变量. · 声明一个内部函数/变量. 2.extern · 定义一个外部函数/变量. · 声明一个外部函数/变量. ...

  10. GCD基础知识总结

    iOS三种多线程编程技术: 1.NSThread 2.NSOperation 3.GCD(Grand Central Dispatch) 从上到下,抽象度层次从低到高,抽象度越高的使用越简单,也是Ap ...