我的布局有一个奇怪的问题。 我有一个带有CollapsingToolBarLayout的CoordinatorLayout 。 我有一个透明的状态栏,可以在顶部更好地显示图像。 因此,我在此ImageView上设置了fitsSystemWindow 。 我现在遇到的问题是,当工具栏完全合拢时,工具栏的顶部滚动到系统状态栏的后面。 有没有办法防止这种行为?

这是屏幕截图:

这是我的布局:

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:id="@+id/coordinatorLayout">

android:id="@+id/main_appbar"

android:layout_width="match_parent"

android:layout_height="wrap_content"

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

android:id="@+id/main_collapsing"

android:layout_width="match_parent"

android:layout_height="350dp"

app:layout_scrollFlags="scroll|exitUntilCollapsed"

app:contentScrim="?attr/colorPrimary"

app:expandedTitleMarginStart="140dp"

app:expandedTitleMarginBottom="90dp"

app:expandedTitleMarginEnd="64dp"

android:fitsSystemWindows="true">

app:layout_collapseMode="parallax"

android:id="@+id/icon"

android:transitionName="pic"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:scaleType="centerCrop"

android:src="@drawable/missing_album_art"

android:tint="#AA000000"

android:fitsSystemWindows="true"/>

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginBottom="20dp"

app:layout_collapseMode="parallax">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="bottom"

android:padding="20dp"

android:orientation="horizontal">

android:layout_width="100dp"

android:layout_height="100dp"

android:id="@+id/smallicon"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="vertical"

android:layout_gravity="bottom"

android:padding="20dp">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:id="@+id/artist"

android:ellipsize="end"

android:singleLine="true"

android:textSize="24sp"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:ellipsize="end"

android:singleLine="true"

android:id="@+id/date"/>

android:id="@+id/main_toolbar"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

app:popupTheme="@style/ThemeOverlay.AppCompat.Light"

app:layout_collapseMode="pin" />

android:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior"

android:id="@+id/list"

android:dividerHeight="2dp"

android:transitionName="bottom">

另外,在创建活动时,我会稍微调整布局参数:

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

android ?attr得到状态栏高度,android - 状态栏下方的CoordinatorLayout + CollapsingToolbarLayout滚动 - 堆栈内存溢出...相关推荐

  1. android 数据库 字节数组,java - 如何使用活动的android序列化字节数组并将其存储到数据库中? - 堆栈内存溢出...

    我有一个图像作为byte[] ,我需要将此图像保存在数据库中. 我为此使用Active Android库. 我知道db中用于此目的的数据类型应该是BLOB. 我知道byte[]不能直接存储,我知道它应 ...

  2. android7.0模拟器调试,android - 为什么在android 7.0及更高版本上出现模拟器错误? - 堆栈内存溢出...

    我正在开发将联系人保存在.vcf文件中的应用程序. 当我运行模拟器来测试应用程序时,我还会收到以下错误. 应用程序正在物理设备上运行. 但是android 7.0及更高版本的模拟器也给出了错误. (警 ...

  3. Android获取的状态栏高度,Android中获取状态栏高度的两种方法分享

    前言 最近在做一个关于FAB的功能的时候需要获取状态栏的高度,在网上查了很多种方法,下面是选出的比较合理的两个方法.主要参考stackoverflow的这篇问答:http://stackoverflo ...

  4. android 电池栏的高度,Android如何取得状态栏、任务栏高度

    释放双眼,带上耳机,听听看~! 对于在Android中取得状态栏.任务栏高度这个问题是很多用户们都表示好奇的,那么接下来我们就一起去看看Android如何取得状态栏.任务栏高度的内容. package ...

  5. android density 和款高度,Android Density(密度)

    1.  什么是density 引用 1) density density表示每英寸有多少个显示点(逻辑值),它的单位是dpi:dot per inch,通常屏幕大时,density就大,屏幕小时,de ...

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

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

  7. Android消息向下堆积,android - 从CoordinatorLayout中的按钮单击事件触发NestedScroll折叠动作 - 堆栈内存溢出...

    我有一个CoordinatorLayout,它包含一个ViewPager,该控件使用嵌套的滚动行为可以正常滚动. 但是,我想在单击按钮时触发滚动/折叠行为. 如何通过单击按钮来控制这种崩溃行为. 通过 ...

  8. android autolink识别错误,android - autolink窃取ontouch事件,从而反馈触摸列表视图行无效 - 堆栈内存溢出...

    我有一个listview . 并且行布局中包含很少的布局. 在行布局中,我有一个TextView ,我想在其上启用自动链接当我启用自动链接时,链接工作正常但我们点击列表行时得到的反馈不再有效. 在行布 ...

  9. android 电视安装apk文件损坏,android - 无法在Android电视盒上安装APK - 堆栈内存溢出...

    我正在为Android TV编写应用程序. 它可以在模拟器上正常运行,并在Android电视盒上以调试模式运行. 但是,当我使用Android Studio生成apk并尝试将该apk安装在同一盒子上时 ...

最新文章

  1. 学python最重要的是_为什么越来越多的人选择学Python?
  2. jasmine.FunctionMatchers.toHaveBeenCalledWith的单步调试
  3. oracle导入del数据文件,pl/sql,Oracle数据库中,不小心delete数据并递交后如何恢复被删数据...
  4. C#中static void Main(string[ ] args)中的作用及解释
  5. 【LightOJ - 1038】Race to 1 Again(概率dp,数学期望)
  6. @GeneratedValue不能使属性自增长
  7. python判断汉字偏胖_写了2年python,知道 if __name__ == '__main__' 什么意思吗?
  8. How to Root Nexus 5 on Android 4.4.4 KTU84P and Install CWM Recovery
  9. linux压缩zip下载,linux下wget下载文件到指定目录,解压zip文件,解压与压缩总结...
  10. 《深度学习技术图像处理入门》看书知识点总结
  11. 外网远程桌面连接内网服务器教程(超详细)
  12. 史上首例!阿里程序员写的这一行代码,被国家博物馆收藏了
  13. 负数(一):猎人的过冬“法宝”
  14. 英语自我介绍资料及范文
  15. 高数:第四章(同济大学第七版)
  16. 百分点认知智能实验室:如何打造工业级的机器翻译
  17. php sku 代码编写,SKU代码生成规则
  18. python将一组数zscore归一化
  19. css修改element组件中el-date-picker中的placeholder样式失效
  20. 职场中的天龙八部——北漂18年(53)

热门文章

  1. 我的大学生活充满遗憾和后悔!
  2. 如何对 BCGControlBarPro 进行换肤
  3. 复平面上gamma函数_复变量Gamma函数及解析性质
  4. java 锁有哪些特性_java锁有哪些类(转)
  5. 工信部部长李毅中:警惕IBM智慧地球陷阱
  6. android录制10秒视频教程,快手怎样录制60秒视频 快手怎么录长视频教程
  7. uniapp开发:瀑布流 灵活配置 简单易用 兼容vue2vue3小程序、H5、app等多端
  8. 从计算机用途上看 家用计算机属于,致青春:那些年我们玩过的电脑小学篇
  9. 总结一下2021年阅读和运动
  10. 非易失性规划的原理与实现方法