FrameLayout(帧布局),安卓framework开发书籍

android:text=“按钮2”/>

<Button

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_alignBottom=“@+id/btn_two”

android:layout_marginBottom=“100dp”

android:layout_toRightOf=“@+id/btn_two”

android:text=“按钮3”/>

在这里插入图片描述

上述代码中,“按钮1”通过 android:layout_alignParentBottom 属性指定当前控件位于布局底端,通过这两个属性的控制,“按钮1”距离底端的距离为20dp。

“按钮2”通过 android:layout_centerHorizontal 属性指定它在父布局中水平居中,通过 android:layout_marginTop 属性指定当前控件上边缘与父布局顶部距离260dp。

“按钮3”通过 android:layout_alignBottom 属性指定它与“按钮2”底部对齐,通过 android:layout_marginBottom属性指定距离“按钮2”底部100dp,android:layout_toRightOf 属性指定了它将被放在按钮2的右边。

相对布局除了上面列出来的一些属性之外,还有其他很多的属性如下所示(参照 http://www.miui.com/thread-574167-1-1.html )

相对于兄弟元素

android:layout_below=“@id/aaa”:在指定View的下方

android:layout_above=“@id/xxx”:在指定View的上方

android:layout_toLeftOf=“@id/bbb”:在指定View的左边

android:layout_toRightOf=“@id/cccc”:在指定View的右边

相对于父元素

android:layout_alignParentLeft=“true”:在父元素内左边

android:layout_alignParentRight=“true”:在父元素内右边

android:layout_alignParentTop=“true”:在父元素内顶部

android:layout_alignParentBottom=“true”:在父元素内底部

对齐方式

android:layout_centerInParent=“true”:居中布局

android:layout_centerVertical=“true”:水平居中布局

android:layout_centerHorizontal=“true”:垂直居中布局

android:layout_alignTop=“@id/xxx”:与指定View的上边界一致

android:layout_alignBottom=“@id/xxx”:与指定View下边界一致

android:layout_alignLeft=“@id/xxx”:与指定View的左边界一致

android:layout_alignRight=“@id/xxx”:与指定View的右边界一致

间隔

android:layout_marginBottom=“”; 离某元素底边缘的距离

android:layout_marginLeft=“”; 离某元素左边缘的距离

android:layout_marginRight =“”;离某元素右边缘的距离

android:layout_marginTop=“”; 离某元素上边缘的距离

android:layout_paddingBottom=“”; 离父元素底边缘的距离

android:layout_paddingLeft=“”; 离父元素左边缘的距离

android:layout_paddingRight =“”;离父元素右边缘的距离

android:layout_paddingTop=“”; 离父元素上边缘的距离

FrameLayout—帧布局


帧布局是最为简单的一种布局,该布局为每个加入其中的控件创建一个空白区域,称为一帧,每个控件占据一帧。采用帧布局时,所有控件都默认显示在屏幕左上角,并按照先后放入的顺序重叠摆放,先放入的将会在最底层,后放入的控件显示在最顶层。帧布局使用于图层设计。

其中:foreground 属性设置帧布局容器的前景图像

foregroundGravity 属性设置图像的显示位置

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android=“http://schemas.android.com/apk/res/android”

android:layout_width=“match_parent” android:layout_height=“match_parent”

android:foreground=“@mipmap/iclauncher”

android:foregroundGravity=“left”>

<Button

android:layout_width=“300dp”

android:layout_height=“450dp”

android:text=“按钮1”/>

<Button

android:layout_width=“200dp”

android:layout_height=“210dp”

android:text=“按钮2”/>

在这里插入图片描述

TableLayout—表格布局


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:orientation=“vertical”

<TextView

android:id=“@+id/text1”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“①隐藏、收缩、扩展” />

<TableLayout

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:collapseColumns=“2”

android:shrinkColumns=“1”

android:stretchColumns=“0”>

<Button

android:id=“@+id/b1”

android:text=“第一列可以行扩展” />

<Button

android:id=“@+id/b2”

android:text=“第二列可以列扩展” />

<Button

android:id=“@+id/b3”

android:text=“第三列是被隐藏的列” />

<TextView

android:id=“@+id/text2”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:text=“②单元格的属性设置” />

<TableLayout

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”>

<Button

android:id=“@+id/b11”

android:text=“第一列” />

<Button

android:id=“@+id/b22”

android:text=“第二列” />

<Button

android:id=“@+id/b33”

android:text=“第三列” />

<TextView android:text=“横跨了1到2列………………………”

android:layout_span=“2”

android:layout_column=“1”/>

<TextView

android:id=“@+id/text3”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级安卓工程师,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Android移动开发全套学习资料》送给大家,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注Android)
img

面试复习笔记:

这份资料我从春招开始,就会将各博客、论坛。网站上等优质的Android开发中高级面试题收集起来,然后全网寻找最优的解答方案。每一道面试题都是百分百的大厂面经真题+最优解答。包知识脉络 + 诸多细节。
节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习。
给文章留个小赞,就可以免费领取啦~

戳我领取:GitHub

《960页Android开发笔记》

《1307页Android开发面试宝典》

包含了腾讯、百度、小米、阿里、乐视、美团、58、猎豹、360、新浪、搜狐等一线互联网公司面试被问到的题目。熟悉本文中列出的知识点会大大增加通过前两轮技术面试的几率。

《507页Android开发相关源码解析》

只要是程序员,不管是Java还是Android,如果不去阅读源码,只看API文档,那就只是停留于皮毛,这对我们知识体系的建立和完备以及实战技术的提升都是不利的。

d开发笔记》**

[外链图片转存中…(img-sB01idVo-1711184274086)]

《1307页Android开发面试宝典》

包含了腾讯、百度、小米、阿里、乐视、美团、58、猎豹、360、新浪、搜狐等一线互联网公司面试被问到的题目。熟悉本文中列出的知识点会大大增加通过前两轮技术面试的几率。

[外链图片转存中…(img-ANspGpqJ-1711184274086)]

《507页Android开发相关源码解析》

只要是程序员,不管是Java还是Android,如果不去阅读源码,只看API文档,那就只是停留于皮毛,这对我们知识体系的建立和完备以及实战技术的提升都是不利的。

真正最能锻炼能力的便是直接去阅读源码,不仅限于阅读各大系统源码,还包括各种优秀的开源库。

  • 10
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值