当前位置: 首页 > news >正文

网站排名 优帮云游戏小程序代理

网站排名 优帮云,游戏小程序代理,公司注册代理免费咨询,企业做网站的好处千秋网络线性布局LinearLayout相对布局RelativeLayout帧布局FrameLayout表格布局TableLayout绝对布局AbsoluteLayout网格布局GridLayout Android开发者谷歌文档 keyValueandroid:gravity控件布局方式android:layout_gravity布局方式android:persistentDrawingCachehua定义绘图的高速缓…线性布局LinearLayout相对布局RelativeLayout帧布局FrameLayout表格布局TableLayout绝对布局AbsoluteLayout网格布局GridLayout Android开发者谷歌文档 keyValueandroid:gravity控件布局方式android:layout_gravity布局方式android:persistentDrawingCachehua定义绘图的高速缓存的持久性android:descendantFocusability控制子布局焦点获取方式 常用于listView的item中包含多个控件 点击无效android:scrollbars设置滚动条的状态android:scrollbarStyle设置滚动条的样式android:fitsSystemWindows设置布局调整时是否考虑系统窗口(如状态栏)android:scrollbarFadeDuration设置滚动条淡入淡出时间android:scrollbarDefaultDelayBeforeFade设置滚动条N毫秒后开始淡化以毫秒为单位。android:scrollbarSize设置滚动调大小android:fadingEdge设置拉滚动条时 ,边框渐变的放向android:drawingCacheQuality设置绘图时半透明质量android:OverScrollMode滑动到边界时样式android:alpha设置透明度android:rotation旋转度数android:rotationX水平旋转度数android:rotationY垂直旋转度数android:scaleX设置X轴缩放android:scaleY设置Y轴缩放android:verticalScrollbarPosition设置垂直滚动条的位置android:layerType设定支持android:layoutDirection定义布局图纸的方向android:textDirection定义文字方向android:textAlignment文字对齐方式android:importantForAccessibility设置可达性的重要行android:labelFor添加标签 keyValueandroid:layout_centerHrizontal水平居中android:layout_centerVertical垂直居中android:layout_centerInparent相对于父元素完全居中android:layout_alignParentBottom贴紧父元素的下边缘android:layout_alignParentLeft贴紧父元素的左边缘android:layout_alignParentRight贴紧父元素的右边缘android:layout_alignParentTop贴紧父元素的上边缘android:layout_alignWithParentIfMissing如果对应的兄弟元素找不到的话就以父元素做参照物android:layout_alignParentStart紧贴父元素结束位置开始android:layout_alignParentEnd紧贴父元素结束位置结束android:animateLayoutChanges布局改变时是否有动画效果android:clipChildren定义子布局是否一定要在限定的区域内android:clipToPadding定义布局间是否有间距android:animationCache定义子布局也有动画效果android:alwaysDrawnWithCache定义子布局是否应用绘图的高速缓存android:addStatesFromChildren定义布局是否应用子布局的背景android:splitMotionEvents定义布局是否传递touch事件到子布局android:focusableInTouchMode定义是否可以通过touch获取到焦点android:isScrollContainer定义布局是否作为一个滚动容器 可以调整整个窗体android:fadeScrollbars滚动条自动隐藏android:fitsSystemWindows设置布局调整时是否考虑系统窗口(如状态栏)android:visibility定义布局是否可见android:requiresFadingEdge定义滚动时边缘是否褪色android:clickable定义是否可点击android:longClickable定义是否可长点击android:saveEnabled设置是否在窗口冻结时如旋转屏幕保存View的数据android:filterTouchesWhenObscured所在窗口被其它可见窗口遮住时,是否过滤触摸事件android:keepScreenOn设置屏幕常亮android:duplicateParentState是否从父容器中获取绘图状态(光标,按下等)android:soundEffectsEnabled点击或触摸是否有声音效果android:hapticFeedbackEnabled设置触感反馈 keyValueandroid:layout_alignBaseline本元素的文本与父元素文本对齐android:layout_below在某元素的下方android:layout_above在某元素的的上方android:layout_toLeftOf在某元素的左边android:layout_toRightOf在某元素的右边android:layout_toStartOf本元素从某个元素开始android:layout_toEndOf本元素在某个元素结束android:layout_alignTop本元素的上边缘和某元素的的上边缘对齐android:layout_alignLeft本元素的左边缘和某元素的的左边缘对齐android:layout_alignBottom本元素的下边缘和某元素的的下边缘对齐android:layout_alignRight本元素的右边缘和某元素的的右边缘对齐android:layout_alignStart本元素与开始的父元素对齐android:layout_alignEnd本元素与结束的父元素对齐android:ignoreGravity指定元素不受重力的影响android:layoutAnimation定义布局显示时候的动画android:id为布局添加ID方便查找android:tag为布局添加tag方便查找与类似android:scrollbarThumbHorizontal设置水平滚动条的drawable。android:scrollbarThumbVertical设置垂直滚动条的drawableandroid:scrollbarTrackHorizontal设置水平滚动条背景轨迹的色drawableandroid:scrollbarTrackVertical设置垂直滚动条背景轨迹的色drawableandroid:scrollbarAlwaysDrawHorizontalTrack设置水平滚动条是否含有轨道android:scrollbarAlwaysDrawVerticalTrack设置垂直滚动条是否含有轨道android:nextFocusLeft设置左边指定视图获得下一个焦点android:nextFocusRight设置右边指定视图获得下一个焦点android:nextFocusUp设置上边指定视图获得下一个焦点android:nextFocusDown设置下边指定视图获得下一个焦点android:nextFocusForward设置指定视图获得下一个焦点android:contentDescription说明android:OnClick点击时从上下文中调用指定的方法 keyValueandroid:layout_width定义本元素的宽度android:layout_height定义本元素的高度android:layout_margin本元素离上下左右间的距离android:layout_marginBottom离某元素底边缘的距离android:layout_marginLeft离某元素左边缘的距离android:layout_marginRight离某元素右边缘的距离android:layout_marginTop离某元素上边缘的距离android:layout_marginStart本元素里开始的位置的距离android:layout_marginEnd本元素里结束位置的距离android:scrollX水平初始滚动偏移android:scrollY垂直初始滚动偏移android:background本元素的背景android:padding指定布局与子布局的间距android:paddingLeft指定布局左边与子布局的间距android:paddingTop指定布局上边与子布局的间距android:paddingRight指定布局右边与子布局的间距android:paddingBottom指定布局下边与子布局的间距android:paddingStart指定布局左边与子布局的间距与android:paddingLeft相同android:paddingEnd指定布局右边与子布局的间距与android:paddingRight相同android:fadingEdgeLength设置边框渐变的长度android:minHeight最小高度android:minWidth最小宽度android:translationX水平方向的移动距离android:translationY垂直方向的移动距离android:transformPivotX相对于一点的水平方向偏转量android:transformPivotY相对于一点的垂直方向偏转量 线性布局 LinearLayout又称作线性布局是一种非常常用的布局。 这个布局会将它所包含的控件在线性方向上依次排列。 既然是线性排列肯定就不仅只有一个方向那为什么上一节中的控件都是在垂直方向排列的呢这是由于我们通过android:orientation属性制定了排列方向是vertical。 如果指定的是horizontal 控件就会在水平方向上排列了。 注意如果LinearLayout的排列方向是horizontal内部的控件就绝对不能将宽度指定为match_parent,因为如果这样的话单独一个控件就会将整个水平方向占满其他的控件就没有可放置的位置了。同样的道理如果LinearLayout的排列方向是vertical内部的控件就不能将高度指定为match_parent。 首先来看 android:layout_gravity属性 和android:gravity属性看起来有些相似这两个属性有什么区别呢 其实从名字就可以看出来 android:gravity用于指定文字在控件中的对齐方式而android:layout_gravity用于指定控件在布局中的对齐方式。 android:layout_gravity的可选值和android:gravity差不多但是需要注意当LinearLayout的排列方向是horizontal时只有垂直方向上的对齐方式才会生效因为此时水平方向上的长度是不固定的每次加一个控件水平方向上的长度都会改变因而无法指定该方向上的对齐方式。同样的道理当LinearLayout的排列方向是vertical时只有水平方向上的对齐方式才会生效。 LinearLayout中另一个重要的属性。 ------android:layout_weight.这个属性允许我们使用比例的方式来指定控件的大小它在手机屏幕的适配性方面可以起到非常重要的作用。 当时用android:layout_weight属性此时控件的宽度就不应该再由android:layout_width来决定这里指定成0dp是一种比较规范的写法。 另外dp是Android中用于指定控件大小、间距等属性的单位后面我们还会经常用到它。 LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:orientationhorizontalandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentEditTextandroid:layout_width0dpandroid:layout_heightwrap_contentandroid:layout_weight3android:hintType something/Buttonandroid:idid/sendandroid:layout_width0dpandroid:layout_heightwrap_contentandroid:layout_weight2android:textSend//LinearLayout然后再EditText和Button里都将android:layout_weight属性的值指定为1这表示EditText和Button将在水平方向平分宽度。 为什么将android:layout_weight属性的值同时指定为1就会平分屏幕宽度呢 系统会先把LinearLayout下所有控件指定的layout_weight值相加得到一个总值然后每个控件所占大小的比例就是用该控件的layout_weight值除以刚才算出的总值。 我们还可以通过指定部分控件的layout_weight值来实现更好的效果。 相对布局 RalativeLayout又称作相对布局也是一种非常常用的布局。和LinearLayout的排列规则不同RelativeLayout显得更加随意一些。他可以通过相对定位的方式让控件出现在布局的任何位置也正因为如此RelativeLayout中的属性非常多不过这些属性都是有规律可循的其实不难理解和记忆。 RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentButtonandroid:idid/button1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_aboveid/button3android:layout_toLeftOfid/button3android:textButton1/Buttonandroid:idid/button2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_aboveid/button3android:layout_toRightOfid/button3android:textButton2/Buttonandroid:idid/button3android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerInParenttrueandroid:textButton3/Buttonandroid:idid/button4android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/button3android:layout_toLeftOfid/button3android:textButton4/Buttonandroid:idid/button5android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/button3android:layout_toRightOfid/button3android:textButton5/ /RelativeLayout这次的代码复杂一点但是仍然有规律可循。 android:layout_above属性可以让一个空间位于另一个控件的上方需要为这个属性指定相对控件id的引用这里我们填入了id/button3表示让该控件位于Button3的上方。其他的属性也都是相似的。android:layout_below表示让一个控件位于另一个控件的下方android:layout_toLeftOf表示让一个控件位于另一个控件的左侧android:layout -toRightOf表示让一个控件位于另一个控件的右侧。 注意当一个控件去引用另一个控件的id时该控件一定要定义在引用控件的后面不然会出现找不到id的情况。 RelativeLayout中还有另外一组相对于控件进行定位的属性android:layout_alignLeft表示让一个控件的左边缘和另一个控件的左边缘对齐。 此外还有android:layout_alignTop和androidlayout_alignBottom道理都是一样的。 RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentButtonandroid:idid/button1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_aboveid/button3android:layout_alignLeftid/button3android:textButton1/Buttonandroid:idid/button2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_aboveid/button3android:layout_alignRightid/button3android:textButton2/Buttonandroid:idid/button3android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerInParenttrueandroid:textButton3/Buttonandroid:idid/button4android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/button3android:layout_toLeftOfid/button3android:textButton4/Buttonandroid:idid/button5android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/button3android:layout_toRightOfid/button3android:textButton5/ /RelativeLayout帧布局 FrameLayout又称作帧布局他相比于前面两种布局就简单太多了。因此它的应用场景也少了很多。这种布局没有方便的定位方式所有的控件都会默认摆放在布局的左上角。 ?xml version1.0 encodingutf-8? FrameLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:backgroundcolor/blueFrameLayoutandroid:layout_width300dpandroid:layout_height500dpandroid:backgroundcolor/dark_orangeFrameLayoutandroid:layout_width200dpandroid:layout_height300dpandroid:backgroundcolor/colorAccent/FrameLayout/FrameLayoutImageViewandroid:idid/image_viewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:srcmipmap/ic_launcher//FrameLayoutTableLayout 相信学过HTML的朋友都知道,我们可以通过 table tr td 就可以生成一个HTML的表格, 而Android中也允许我们使用表格的方式来排列组件,就是行与列的方式,就说我们这节的TableLayout! 但却不像我们后面会讲到的Android 4.0后引入的GridLayout(网格)布局一样,直接就可以设置多少行与多少列 如何确定行数与列数 ①如果我们直接往TableLayout中添加组件的话,那么这个组件将占满一行 ②如果我们想一行上有多个组件的话,就要添加一个TableRow的容器,把组件都丢到里面 ③tablerow中的组件个数就决定了该行有多少列,而列的宽度由该列中最宽的单元格决定 ④tablerow的layout_width属性,默认是fill_parent的,我们自己设置成其他的值也不会生效 但是layout_height默认是wrapten——content的,我们却可以自己设置大小 ⑤整个表格布局的宽度取决于父容器的宽度(占满父容器本身) ⑥有多少行就要自己数啦,一个tablerow一行,一个单独的组件也一行多少列则是看tableRow中 的组件个数,组件最多的就是TableLayout的列数 三个常用属性 android:collapseColumns:设置需要被隐藏的列的序号 android:shrinkColumns:设置允许被收缩的列的列序号 android:stretchColumns:设置运行被拉伸的列的列序号 以上这三个属性的列号都是从0开始算的,比如shrinkColunmns “2”,对应的是第三列 可以设置多个,用逗号隔开比如0,2,如果是所有列都生效,则用*号即可 除了这三个常用属性,还有两个属性,分别就是跳格子以及合并单元格,这和HTML中的Table类似: android:layout_column“2”:表示的就是跳过第二个,直接显示到第三个格子处,从1开始算的! android:layout_span“4”:表示合并4个单元格,也就说这个组件占4个单元格 collapseColumns(隐藏列) ?xml version1.0 encodingutf-8? TableLayout android:idid/TableLayout2android:layout_widthfill_parentandroid:layout_heightwrap_contentandroid:collapseColumns0,2xmlns:androidhttp://schemas.android.com/apk/res/androidTableRowButtonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textone /Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:texttwo /Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textthree /Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textfour /Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textfive / /TableRow/TableLayoutstretchColumns(拉伸列) 流程:在TableLayout中设置了四个按钮,接着在最外层的TableLayout中添加以下属性: android:stretchColumns “1” 设置第二列为可拉伸列,让该列填满这一行所有的剩余空间,代码如下: TableLayout android:idid/TableLayout2 android:layout_widthfill_parent android:layout_heightwrap_content android:shrinkColumns1 TableRow Button android:layout_widthwrap_content android:layout_heightwrap_content android:textone / Button android:layout_widthwrap_content android:layout_heightwrap_content android:texttwo / Button android:layout_widthwrap_content android:layout_heightwrap_content android:textthree / Button android:layout_widthwrap_content android:layout_heightwrap_content android:textfour / Button android:layout_widthwrap_content android:layout_heightwrap_content android:textfive / TextView android:layout_widthwrap_content android:layout_heightwrap_content android:text文本XX / /TableRow /TableLayout从图中我们可以看到two这个按钮被挤压成条条状,这个就是收缩,为了保证表格能适应 父容器的宽度至于另外两个属性就不讲解了,用法和HTML相同有兴趣的可以研究下 绝对布局AbsoluteLayout不常用想学的可以看这篇 网格布局GridLayout 属性作用android:columnCount最大列数android:rowCount最大行数android:orientationGridLayout中子元素的布局方向android:alignmentModealignBounds对齐子视图边界 alignMargins 对齐子视距内容默认值android:columnOrderPreserved使列边界显示的顺序和列索引的顺序相同默认是trueandroid:rowOrderPreserved使行边界显示的顺序和行索引的顺序相同默认是trueandroid:useDefaultMargins没有指定视图的布局参数时使用默认的边距默认值是false item属性 属性作用android:layout_column指定该单元格在第几列显示android:layout_row指定该单元格在第几行显示android:layout_columnSpan指定该单元格占据的列数android:layout_rowSpan指定该单元格占据的行数android:layout_gravity指定该单元格在容器中的位置android:layout_columnWeightAPI21加入列权重android:layout_rowWeightAPI21加入 行权重 android:layout_gravity作用center不改变元素的大小仅居中center_horizontal不改变大小水平居中center_vertical不改变大小垂直居中top不改变大小置于顶部left不改变大小置于左边bottom不改变大小置于底部right不改变大小置于右边start不改变大小根据系统语言置于开始位置end不改变大小置于结尾fill拉伸元素控件填满其应该所占的格子fill_vertical仅垂直方向上拉伸填充fill_horizontal仅水平方向上拉伸填充clip_vertical垂直方向上裁剪元素仅当元素大小超过格子的空间时clip_horizontal水平方向上裁剪元素仅当元素大小超过格子的空间时 注意 使用layout_columnSpan 、layout_rowSpan时要加上layout_gravity属性否则没有效果另外item在边缘时宽高计算会出现错误需要我们手动设置宽高否则达不到想要的效果 实例 ?xml version1.0 encodingutf-8? GridLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:idid/GridLayout1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:columnCount4android:orientationhorizontalandroid:rowCount6 TextViewandroid:layout_columnSpan4android:layout_gravityfillandroid:layout_marginLeft5dpandroid:layout_marginRight5dpandroid:background#FFCCCCandroid:text0android:textSize50sp /Buttonandroid:layout_columnSpan2android:layout_gravityfillandroid:text回退 /Buttonandroid:layout_columnSpan2android:layout_gravityfillandroid:text清空 /Button android:text /Button android:text1 /Button android:text2 /Button android:text3 /Button android:text- /Button android:text4 /Button android:text5 /Button android:text6 /Button android:text* /Button android:text7 /Button android:text8 /Button android:text9 /Button android:text/ /Buttonandroid:layout_widthwrap_contentandroid:text. /Button android:text0 /Button android:text //GridLayout
http://www.hkea.cn/news/14286250/

相关文章:

  • 天河做网站系统泉州网页制作设计
  • 购物网站建设行业现状网络推广公司案例
  • 网站开发和系统开发区别建设网站项目概况
  • 昆明网站推广公司湖南城乡和建设厅网站
  • 珠海网站建设优化购买网站域名多少钱
  • 网站关键词排名提高西安公积金 网站建设
  • 手机网站如何制作免费商务网站建设流程
  • 朝阳网站建设 国展wordpress长图拼接
  • 购物商城网站制作成都网站建设 今网科技
  • 互联网做视频网站需要许可证吗怎么做潮牌网站
  • 海口网站建设策划方案定制化网站开发
  • 如何选择制作网站公司肖云路那有做网站公司
  • 哔哩哔哩网站重庆在线高校开放平台
  • 浙江建设继续教育学院网站单页面网站怎么优化
  • 快站官方客户端下载完全不收费的聊天软件
  • 漯河网站推广公司售后管理系统软件
  • 西安网站网页设计我想注册公司怎么注册
  • 做个网站费用多少合适可以免费开店的平台
  • c++实现微博第三方登录 没有公司和网站如何做网推技巧
  • 自己做的网站怎么接支付宝网站建设中的问题
  • nat123做视频网站西部数码上传网站
  • 站长之家ping检测旅游网站开发毕业设计
  • 江小白网络营销案例分析手机清理优化软件排名
  • 做网站的例子网站icp备案新规
  • 设计师图片素材网站有哪些创建一个网络平台需要多少钱
  • 域名销售网站长春有什么好的网站制作公司
  • 做贸易把产品放到哪个网站好呢网页设计与制作设计报告
  • 网站开发开源的手册WordPress 经典编辑器
  • 网站排名费用深圳市外贸网站
  • wordpress搭建vip下载站软件app开发定制