android布局学习-使用FrameLayout和LinearLayout制作QQ空间底部导航栏
【声明:本博客通过学习“J灬叶小超 ”博客而写,链接:http://www.cnblogs.com/yc-755909659/p/4288260.html】
--------------------------------------------------------------------------------------------------------
界面效果如下所示:

-------------------------------------------------------------------------------------------------------------
【分析】
此导航栏的设计通过FrameLayout和LinearLayout编写,我们知道每个FrameLayout都是具有叠加效果:
(通过图片可以进一步理解)
对这个分析,小编花了一个图:

-------------------------------------------------------------------------------------------------------------
【代码】
<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"> <FrameLayout
android:id="@+id/frame_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/frameMenu"
android:layout_alignParentTop="true">
</FrameLayout> <FrameLayout
android:id="@+id/frameMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/skin_tabbar_bg"
android:orientation="horizontal">
<!--动态-->
<FrameLayout
android:id="@+id/layout_at"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/image_at"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:background="@drawable/skin_tabbar_icon_auth_select"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:text="@string/skin_tabbar_icon_auth"
android:textSize="12sp"/>
</FrameLayout>
<!-- 与我相关 --> <FrameLayout
android:id="@+id/layout_auth"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" > <ImageView
android:id="@+id/image_auth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:src="@drawable/skin_tabbar_icon_at_select" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:text="@string/skin_tabbar_icon_at"
android:textColor="@android:color/black"
android:textSize="12sp" />
</FrameLayout>
<!-- 留白 --> <FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</FrameLayout>
<!-- 我的空间 --> <FrameLayout
android:id="@+id/layout_space"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" > <ImageView
android:id="@+id/image_space"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:src="@drawable/skin_tabbar_icon_space_select" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:text="@string/skin_tabbar_icon_space"
android:textColor="@android:color/black"
android:textSize="12sp" />
</FrameLayout> <!-- 玩吧 --> <FrameLayout
android:id="@+id/layout_more"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" > <ImageView
android:id="@+id/image_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:src="@drawable/skin_tabbar_icon_more_select" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:text="@string/skin_tabbar_icon_more"
android:textColor="@android:color/black"
android:textSize="12sp" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@android:color/black" >
</LinearLayout>
</FrameLayout>
<!-- 中间按钮背景 --> <ImageView
android:id="@+id/toggle_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/frameMenu"
android:layout_centerInParent="true"
android:src="@drawable/skin_tabbar_btn"/> <!-- 中间按钮 --> <ImageView
android:id="@+id/plus_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/frameMenu"
android:layout_centerInParent="true"
android:src="@drawable/skin_tabbar_icon_select" /> </RelativeLayout>
【结构图】

【分析】
Q1:布局分析:页面中创建两个FrameLayout,frame_content用于存放图片资源,frameMenu用于存放菜单信息
Q2:菜单分析:菜单的框架采用LinearLayout,这个LinearLayout的基础为FrameLayout,菜单项采用FrameLayout,依次创建了5个
Q3:中间(橘黄色)按钮分析:中间的图片在FrameLayout之外,所以不受FrameLayout的限制,故可以通过布局的方向来设定这两个图片的位置
Q4:菜单项的水平分割线:由于分割线隶属于FrameLayout,所以它的位置应该从左上角开始
android布局学习-使用FrameLayout和LinearLayout制作QQ空间底部导航栏的更多相关文章
- Android 布局学习之——Layout(布局)具体解释二(常见布局和布局參数)
[Android布局学习系列] 1.Android 布局学习之--Layout(布局)具体解释一 2.Android 布局学习之--Layout(布局)具体解释二(常见布局和布局參数) ...
- Android布局学习——android:gravity和android:layout_gravity的区别
[Android布局学习系列] 1.Android 布局学习之——Layout(布局)详解一 2.Android 布局学习之——Layout(布局)详解二(常见布局和布局参数) 3.And ...
- Android 布局学习之——Layout(布局)详解二(常见布局和布局参数)
[Android布局学习系列] 1.Android 布局学习之——Layout(布局)详解一 2.Android 布局学习之——Layout(布局)详解二(常见布局和布局参数) 3.And ...
- Android底部导航栏——FrameLayout + RadioGroup
原创文章,转载请注明出处http://www.cnblogs.com/baipengzhan/p/6285881.html Android底部导航栏有多种实现方式,本文详细介绍FrameLayout ...
- Android学习笔记- Fragment实例 底部导航栏的实现
1.要实现的效果图以及工程目录结构: 先看看效果图吧: 接着看看我们的工程的目录结构: 2.实现流程: Step 1:写下底部选项的一些资源文件 我们从图上可以看到,我们底部的每一项点击的时候都有不同 ...
- Android UI-仿微信底部导航栏布局
现在App基本的标配除了侧滑菜单,还有一个就是底部导航栏,常见的聊天工具QQ,微信,购物App都有底部导航栏,用户可以随便切换看不同的内容,说是情怀也好,用户体验也罢.我们开发的主要的还是讲的是如何如 ...
- Android之RadioGroup+ViewPager制作的底部导航栏
在日常开发中我们常常会用到类似微信或者QQ的底部导航.实现这样的效果有多种,今天就为大家介绍一种实现简单,可控性好的底部导航的实现方法. 首先创建activity_main.xml布局文件,里面主要由 ...
- AndroidStudio制作底部导航栏以及用Fragment实现切换功能
前言 大家好,给大家带来AndroidStudio制作底部导航栏以及用Fragment实现切换功能的概述,希望你们喜欢 学习目标 AndroidStudio制作底部导航栏以及用Fragment实现切换 ...
- Android应用底部导航栏(选项卡)实例
现在很多android的应用都采用底部导航栏的功能,这样可以使得用户在使用过程中随意切换不同的页面,现在我采用TabHost组件来自定义一个底部的导航栏的功能. 我们先看下该demo实例的框架图: 其 ...
随机推荐
- 使用JavaScript打印网页指定DIV区域
JavaScript打印函数myPrint(obj): JavaScript打印页面指定div区域原理:使用window.open()在浏览器打开一个新的页面(window), 使用 window.d ...
- [转]SpringMVC使用@ResponseBody时返回json的日期格式、@DatetimeFormat使用注意
一.SpringMVC使用@ResponseBody时返回json的日期格式 前提了解: @ResponseBody 返回json字符串的核心类是org.springframework.http.co ...
- ubuntu 安装VmTool
VM tools 是Vmware的一组工具.主要用于虚拟主机显示优化与调整,另外还可以方便虚拟主机与本机的交互,如允许共享文件夹,甚至可以直接从本机向虚拟主机拖放文件.鼠标无缝切换.显示分辨率调整等, ...
- Webwork 学习之路【05】请求跳转前 xwork.xml 的读取
个人理解 WebWork 与 Struts2 都是将xml配置文件作为 Controler 跳转的基本依据,WebWork 跳转 Action 前 xml 文件的读取依赖 xwork-1.0.jar, ...
- LINQ的高级应用
---恢复内容开始--- 本文不想罗列linq的通俗使用方法.因为很多博文都已经写得很详细了. 此处直接贴出源码,如果有需要的朋友可以参考,希望更多的朋友能够补充更多的linq的高级应用. 源码如下: ...
- 设置svg图片大小
background-image: url(/resources/img/liveSupport/tx_1.svg); background-size: 16px 16px; width: 16px; ...
- 移动端前端UI库—Frozen UI、WeUI、SUI Mobile
[MUI]http://www.dcloud.io/ [Clouda]http://clouda.baidu.com/blend2是百度历时两年共同研发的开源App技术框架,基于Node.js,简单易 ...
- Ubuntu安装出现左上角光标一直闪解决方式
Ubuntu安装出现左上角光标一直闪解决方式: 01下载ubunu http://cn.ubuntu.com/download/ 02.软碟通 http://pan.baidu.com/s/1qY8O ...
- Go加密解密之DES
一.DES简介 DES(Data Encryption Standard)是对称加密算法,也就是加密和解密用相同的密钥.其入口参数有三个:key.data.mode.key为加密解密使用的密钥,dat ...
- RabbitMQ官方中文入门教程(PHP版) 第一部分:Hello World
RabbitMQ是一个消息代理.它的核心原理非常简单:接收和发送消息.你可以把它想像成一个邮局:你把信件放入邮箱,邮递员就会把信件投递到你的收件人处.在这个比喻中,RabbitMQ是一个邮箱.邮局.邮 ...