CoordinatorLayout+TabLayout+ViewPager
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eee"> <android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="480dp"> <android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed|snap">
<!--内容--> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F5F6F9"
android:orientation="vertical"> <Space
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ccc" /> <ImageView
android:id="@+id/imageView_banner"
android:layout_width="match_parent"
android:layout_height="50dp"
android:scaleType="fitXY" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#fff"
android:gravity="center_vertical"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="精选推荐" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="不容错过的品牌呦"
android:textColor="#FC5A83"
android:textSize="10sp" /> </LinearLayout> <GridView
android:id="@+id/gridView_brand"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#FBFDFA"
android:numColumns="3" /> <Space
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#ccc" /> <GridView
android:id="@+id/gridView_shops"
android:layout_width="match_parent"
android:layout_height="90dp"
android:background="#FBFDFA"
android:numColumns="3" /> <Space
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#ccc" />
</LinearLayout> <!--利用toolbar 为模拟的toolbar和tablayout 进行占位,设置不收缩-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="top"
android:minHeight="?attr/actionBarSize"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin">
<!--模拟toolbar部分-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#fff"
android:orientation="horizontal"> <ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/header_btn_noti_new" /> <TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="私密搭"
android:textSize="20sp" /> <ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/header_btn_nocart" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<!--tablayout 部分-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="bottom"
android:background="#fff"
android:orientation="horizontal"> <SearchView
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#fff" /> <android.support.design.widget.TabLayout
android:id="@+id/tabLayout_brand"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_weight="1"
android:background="#fff"
app:tabIndicatorColor="#000"
app:tabMode="scrollable"
app:tabTextColor="#ccc" />
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_scrolling" />
<!--<android.support.v4.view.ViewPager-->
<!--android:id="@+id/viewpager_brand"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--app:layout_behavior="@string/appbar_scrolling_view_behavior" />-->
</android.support.design.widget.CoordinatorLayout>
CoordinatorLayout+TabLayout+ViewPager的更多相关文章
- TabLayout + ViewPager
一.实现思路 1.在build.gradle中添加依赖,例如: compile 'com.android.support:support-v4:23.4.0'compile 'com.android. ...
- 使用FragmentTabHost+TabLayout+ViewPager实现双层嵌套Tab
大多数应用程序都会在底部使用3~5个Tab对应用程序的主要功能进行划分,对于一些信息量非常大的应用程序,还需要在每个Tab下继续划分子Tab对信息进行分类显示. 本文实现采用FragmentTabHo ...
- 浅谈TabLayout(ViewPager+Tab联动)
google发布了的Android Support Design库中提供了TabLayout 通过TabLayout+ViewPager实现导航栏效果,点击Tab ,ViewPager跟随变化,滑动V ...
- 介绍三个Android支持库控件:TabLayout+ViewPager+RecyclerView
本文主要介绍如下三个Android支持库控件的配合使用: TabLayout:android.support.design.widget.TabLayout ViewPager:android.sup ...
- [置顶]
xamarin Tablayout+Viewpager+Fragment顶部导航栏
最近几天不忙,所以把项目中的顶部导航栏的实现归集一下.android中使用TabLayout+ViewPager+Fragment制作顶部导航非常常见,代码实现也比较简单.当然我这个导航栏是基于xam ...
- Android开发之漫漫长途 Fragment番外篇——TabLayout+ViewPager+Fragment
该文章是一个系列文章,是本人在Android开发的漫漫长途上的一点感想和记录,我会尽量按照先易后难的顺序进行编写该系列.该系列引用了<Android开发艺术探索>以及<深入理解And ...
- ViewPagerWithRecyclerDemo【RecyclerView+ViewPager实现类似TabLayout+ViewPager效果】
版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 使用RecyclerView+ViewPager实现类似TabLayout+ViewPager效果. 效果图 使用步骤 一.项目组织 ...
- 安卓TabLayout+ViewPager实现切页
安卓使用TabLayout+ViewPager+Fragment 实现页面切换,可实现左右滑动切换视图界面和点击切换 可自定义菜单栏是在顶部还是在底部 一.实现效果: 二.实现过程: 2.1 一些重要 ...
- TabLayout+ViewPager 标题不显示问题
第一次用TabLayout+ViewPager 组合在布局中写好了三个标题预览没问题而且也设置了 app:tabIndicatorColor="@color/colorAccent" ...
随机推荐
- DMA控制
1.S3C6410中DMA操作步骤 S3C6410中DMA操作步骤:1.决定使用安全DMAC(SDMAC)还是通用DMAC(DMAC):2.开始相应DMAC的系统时钟,并关闭另外一组的时钟(系统默认开 ...
- /etc/passwd&/etc/shadow文件分析
/etc/passwd该目录存储的是操作系统用户信息,该文件为所有用户可见.给linux系统添加一个帐号:useradd -g mysql -d /home/test -m test(:新建一个用户t ...
- css定位和浮动
1.css中一切元素皆为框.div.p.h1等为块框:span.strong等为行内框,(在文本中每一行会被自动默认为行框,行框和行内框是不一样的概念).通过display可以改变框的类型,行内框通过 ...
- ARCGIS多种影像裁剪
在互联网上下载的遥感影像都进行过分幅处理,下载下来的影像多是规则的四方形,而在进行遥感影像研究时,多是针对特定区域来进行,比如研究北京市的遥感影像,不在北京市范围内的影像对于研究者就没有利用意义,如果 ...
- 监听JVM的几个命令(可用于linux 本机)
1. jstat 这个命令对于查看Jvm的堆栈信息很有用.能够查看eden,survivor,old,perm等heap的capacity,utility信息 对于查看系统是不是有能存泄漏以及参数设置 ...
- VS2010添加资源文件
VS2010中资源文件管理在 双击打开Resources.resx 选择左上角资源文件类型 然后复制资源文件 粘贴到空白区域 则会自动生成资源文件代码 在项目中使用该资源文件时,通过global::P ...
- EUI ToggleButton ToggleSwitch 实现类似音乐开关按钮
一 ToggleButton和ToggleSwitch区别 没区别,就是继承... export class ToggleSwitch extends ToggleButton { /** * @la ...
- tomcat日志文件定时清理备份
以下脚本主要备份的日志文件为tomcat的catalina.out.localhost_access_log.yyyy-mm-dd.log日志和项目的日志文件,其中项目的日志文件格式为"pr ...
- ajax同步异步问题
之前一直在写JQUERY代码的时候遇到AJAX加载数据都需要考虑代码运行顺序问题.最近的项目用了到AJAX同步.这个同步的意思是当JS代码加载到当前AJAX的时候会把页面里所有的代码停止加载,页面出去 ...
- python day 1--python初始
笔者:QQ: 360212316 Python初识 Python的创始人为Guido van Rossum.1989年圣诞节期间,在阿姆斯特丹,Guido为了打发圣诞节的无趣,决心开发一个新的脚本 ...