我目前在Android设计支持库的CoordinatorLayout中遇到了一个FrameLayout的问题,而在创建选项卡时,我遵循了这个

post的指示。

基本上大多数事情按预期工作,容器片段被充填到FrameLayout中,并且它们的标签片段相关性被添加到ViewPager作为选项卡(需要这样做,因为我有很多片段,应该重用布局)。

我正在努力的问题是FrameLayout(结果也是tab片段)消耗整个屏幕高度,所以它与工具栏和TabLayout重叠。为了可视化问题,我创建了以下图像:

Base-Layout with CoordinatorLayout,Toolbar和TabLayout:

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/appBarLayout"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

android:id="@+id/tabLayout"

android:layout_width="match_parent"

android:layout_height="wrap_content" />

android:id="@+id/container"

android:layout_width="match_parent"

android:layout_height="match_parent" />

由容器中膨胀的碎片分开使用的布局:

android:id="@+id/viewPager"

android:layout_height="match_parent"

android:layout_width="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior" />

所有的片段都被我的BaseFragment类(在另一个帖子上,称为inflater.inflate(getLayoutRes(),null);是导致同样问题的问题)

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

return inflater.inflate(getLayoutRes(), container, false);

}

如果我将CoordinatorLayout替换为一个正常的LinearLayout,FrameLayout将按照预期的方式在AppBarLayout下方开始,但是按照documentation,AppBarLayout对于大多数的功能需要是CoordinatorLayout的直接孩子。

我可以添加一个marginTop到FrameLayout,但我想知道是否有任何适当的解决方案。提前感谢任何提示!

android framelayout 高度,Android SupportLib – FrameLayout在CoordinatorLayout中与AppBarLayout消耗整个屏幕高度...相关推荐

  1. CoordinatorLayout中AppBarLayout的折叠仅依靠滑动RecyclerView实现

    直接上效果图,如果不做处理,CoordinatorLayout中的AppBarLayout可以滑动折叠. 我们希望达到如下的效果,即AppBarLayout的折叠仅依靠滑动RecyclerView实现 ...

  2. 仿比心源码,uniApp自适应手机屏幕高度

    仿比心源码,uniApp自适应手机屏幕高度 // 获取屏幕高度用res.screenHeight let _this = this; //uni.getSystemInfoSync异步接口uni.ge ...

  3. android framelayout 高度,android - Android:如何将FrameLayout中的线性布局与底部对齐? - 堆栈内存溢出...

    使用属性layout_gravity对齐FrameLayout中的任何视图 android:layout_gravity:"bottom" /> 但是,如果您尝试将其放置在其 ...

  4. Android开发简单的ViewGroup——FrameLayout

    开门见山的说,一般android开发中,FrameLayout更多的是作为图层功能,或者碎片占位符:如时下的身份证扫描界面,可以利用FrameLayout实现两级图层:再有就是一些自定义的控件,往往是 ...

  5. 浅谈Android五大布局——LinearLayout、FrameLayout和AbsoulteLa

    为什么80%的码农都做不了架构师?>>>    Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦.组件按照布局的要求依次排列,就组成了 ...

  6. Android布局管理器-使用FrameLayout帧布局管理器显示层叠的正方形以及前景照片

    场景 Android布局管理器-使用LinearLayout实现简单的登录窗口布局: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details ...

  7. android 05 桢布局:FrameLayout 网格布据 GridLayout

    xml文件: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"android:l ...

  8. android 布局完成,Android自定义View设定到FrameLayout布局中实现多组件显示的方法 分享...

    < ?xml version="1.0" encoding="utf-8"?> < FrameLayout xmlns:android=&qu ...

  9. Android布局之AbsoluteLayout和FrameLayout

    Android布局之AbsoluteLayout和FrameLayout 1.     AbsoluteLayout 指定子控件的xy精确坐标的布局.绝对布局缺乏灵活性,在没有绝对定位的情况下相比其他 ...

最新文章

  1. scp服务器复制命令跳过已有的文件夹,Linux scp命令复制文件到其它服务器上
  2. We cannot activate inspection type for article master in transaction code MM41?
  3. Java RESTful Web Service实战
  4. Windows 技术篇-WPS关闭推送广告配置方法
  5. Python Day18
  6. [BUUCTF-pwn]——cmcc_simplerop (ropchain)
  7. Kinect开发笔记之三Kinect开发环境配置详解
  8. 鸣人的影分身(信息学奥赛一本通-T1303)
  9. php过滤微信特殊字符方案--》2017新版
  10. xftp6无法使用处理
  11. 重写系统黑色的TabBar
  12. 《推荐系统实践》协同过滤算法源代码
  13. vs2010 sp1 安装错误,重新安装错误
  14. 云计算虚拟化技术和容器技术
  15. 《天才在左疯子在右》读后感
  16. 手机云台——灵眸Osmo Mobile 2
  17. wnmp mysql 密码_WNMP(Windows + Nginx + PHP + MySQL) 安装
  18. 实验一:彩色空间转换(YUV2RGB)
  19. Microsoft Word 教程「4」,如何在 Word 中应用样式、主题?
  20. 4.3 期货每日早盘操作建议

热门文章

  1. 白杨SEO:谈谈如何让微信公众号排版设计好看又实用?
  2. 手游测试(测试内容、测试流程、测试用例)
  3. java 好学_java是什么?对于新手好学吗?
  4. 来看一位淘宝卖家是如何精确的运作微信营销的
  5. Goland自定义头部注释,增加author和data等(学习笔记,不作教程)
  6. android 屏幕亮度声音调节,Android 使用SeekBar 变更屏幕亮度和声音音量
  7. 医疗his系统用什么服务器,his软件用什么服务器
  8. 任务的同步与通信_读书笔记_6
  9. u深度制作linux启动盘制作工具,u深度u盘启动盘制作工具
  10. Oracle体系结构之内存结构(SGA、PGA)