- 1、本文档共9页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
声 明 本套视频教程适用于有一定Java基础的朋友,有J2EE开发经验甚佳。没有学习过Java语言的朋友建议先学习Java,然后再学习本套教程。 如果感觉课程不错,欢迎大家传播,但不得用于商业用途。 实例演示(1) android:gravity 该属性用于控制布局中控件的对齐方式。如果是没有子控件的控件设置此属性,表示其内容的对齐方式,比如说TextView里面文字的对齐方式;若是有子控件的控件设置此属性,则表示其子控件的对齐方式 实例演示(2) android: layout_weight 通过设置控件的layout_weight属性以控制各个控件在布局中的相对大小。layout_weight属性是一个非负整数值。线性布局会根据该控件layout_weight值与其所处布局中所有控件layout_weight值之和的比值为该控件分配占用的区域。例如,在水平布局的LinearLayout中有两个Button,这两个Button的layout_weight属性值都为1,那么这两个按钮都会被拉伸到整个屏幕宽度的一半。如果layout_weight指为0,控件会按原大小显示,不会被拉伸;对于其余layout_weight属性值大于0的控件,系统将会减去layout_weight属性值为0的控件的宽度或者高度,再用剩余的宽度或高度按相应的比例来分配每一个控件显示的宽度或高度 综合实例 Android开发从零开始 ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent LinearLayout android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:layout_weight=1 TextView android:text=红色 android:gravity=center_horizontal|center_vertical android:background=#aa0000 android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1/ TextView android:text=绿色 android:gravity=center_horizontal android:background=#00aa00 android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1/ TextView android:text=蓝色 android:gravity=center|bottom android:background=#0000aa android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1/ TextView android:text=黄色 android:gravity=bottom android:background=#aaaa00 android:layout_width=wrap_content android:layout_height=fill_parent android:layout_weight=1/ /LinearLayout LinearLayout android:orientat
文档评论(0)