- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我注意到我实现的折叠工具栏有两个小问题。我注意到的第一件事是它在工具栏和它下面的回收器 View /嵌套 ScrollView 之间应用了一个插图,创建了一个明显的间隙,如图 A 所示
我注意到的第二个问题是当我向下滚动列表并且工具栏折叠时。如果我单击一个回收器 View 项并导航到下一个 fragment ,然后单击后退按钮并导航回来,工具栏将折叠,但是图像是可见的,需要一两秒才能动画化并再次变为不可见如图 B 所示。
我的 XML 布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="@color/logs_header"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:statusBarScrim="@color/logs_header">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax">
<ImageView
android:id="@+id/headerImage"
android:layout_width="match_parent"
android:layout_height="@dimen/checkin_header_image"
android:scaleType="fitXY"
app:layout_collapseMode="parallax"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_logs_header" />
<ImageView
android:id="@+id/brain"
android:layout_width="@dimen/layout_brain_size"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_32sdp"
android:adjustViewBounds="true"
app:layout_collapseMode="parallax"
app:layout_constraintBottom_toBottomOf="@+id/headerImage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/headerImage"
app:srcCompat="@drawable/brain_workout_logs" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/heading"
style="@style/heading.style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/heading_margin_lr"
android:layout_marginTop="@dimen/heading_margin_top"
android:layout_marginEnd="@dimen/heading_margin_lr"
android:text="@string/logs_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/headerImage" />
<View
android:id="@+id/dividerHeading"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:layout_marginStart="@dimen/divider_heading_lr"
android:layout_marginTop="@dimen/_12sdp"
android:layout_marginEnd="@dimen/divider_heading_lr"
android:background="?android:attr/dividerVertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/heading" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:background="@color/transparent"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin">
<include
android:id="@+id/toolbarLayout"
layout="@layout/toolbar_logs" />
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/childContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvLogs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_6sdp"
android:layout_marginEnd="@dimen/_6sdp"
android:nestedScrollingEnabled="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
任何人都可以帮我解决这两个小错误的根本原因吗?
最佳答案
对于空间问题,您必须删除 android:fitsSystemWindows="true"来自根 CoordinatorLayout 的属性。如果它是真的,那么它会调整这个 View 的填充为系统窗口留出空间(例如:状态栏)。
根据documentation
Boolean internal attribute to adjust view layout based on systemwindows such as the status bar. If true, adjusts the padding of thisview to leave space for the system windows.
关于android - 调试 Android 折叠工具栏 - insets 和 onResume,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66291167/
我有一个 NSBezierPath,我想在路径内绘制插图阴影(类似于 Photoshop)。 有办法做到这一点吗?另外,我知道您可以-描边路径,但是您可以在路径内部描边(类似于Photoshop中的描
我有一张 table ,放在一个带有彩色背景的 div 中。我正在为整个表格使用 border-style:inset。表格的每一行都需要有一个底部边框,我也已经完成了。但是,这些底部边框扩展了表格的
我一直试图获得给定的 curl 阴影效果 here对于 box-shadow:inset 但没有得到任何东西。任何onw有任何线索我可以让它工作吗? 一直试图让它在这个 上工作jsfiddle 将其更
这个问题已经有答案了: UILabel text margin [duplicate] (38 个回答) 已关闭10 年前。 我给 UILabel 加上边框 Label.text = lbltext;
据我了解magrittr::inset()应该能够将向量分配给数据帧中的新列(与 extract() 相反)。但我不明白语法应该如何工作。 假设我有,作为一个玩具示例: df = data.frame
如何将“凹陷”或“嵌入”效果应用于此菜单中的这些字母?我(简要地)查看了 Firebug,但无法找到他们是如何做到的。适用于 FF,不适用于 IE。 参见 http://balsamiq.com/pr
我正在尝试将 UICollectionViewControlller 与 inputAccessoryView 一起用于聊天页面。我使用以下代码尝试将 collectionViewController
我有一个带有 2 个单元格的小型 collectionView。即垂直居中在屏幕上。当用户选择一个单元格时, Collection View 中会出现一个新单元格,并且 Collection View
使用 GDI 时,我能够设置 Pen::Alignment to Inset , 它在路径的内侧绘制了笔划。 SkiaSharp 是否有类似的概念?我已经搜索了所有 SKPaint 文档,但没有找到我
我想要的结果是一个带有粗下划线的标题元素,从左侧稍微偏移,如下所示: 我让下划线与插入的 CSS box-shadow 一起使用,但我不知道如何将它从左侧偏移,以便它不完全与 h2 文本的开头对齐。
我目前正在使用扩展约束布局的自定义 View ,但它不会在 View onApplyWindowInsets(WindowInsets insets) 中触发此覆盖方法,不确定丢失了什么。 cla
我有一个 gridbag 布局,我在其中初始化 gbc.insets = Insets(0,0,0,);稍后我想在发生某些操作时调整此插图的大小。我尝试更改该值,然后执行 repaint() 但这不起
我知道 Firefox 中的 box-shadow(inset) 存在错误。它滞后了很多。我正在尝试为 FF 11 禁用 box-shadow。但是 -moz-box-shadow:none!impo
我的问题是,我想将单元格的 contentView 每个顶部、底部、左侧、右侧插入 10。我想使用这个空间作为分隔符并禁用默认的 TableView 分隔符。没有插图看起来像这样: 现在有两个问题:
我正在尝试一些设计,我希望所有 subview 的边距均等 25 像素。 UISearchController 的 searchBar 在开箱即用的两侧都有 16px 的填充。我是否必须从头开始编写搜
Here是在选择标签上使用框阴影的示例。 但是那里使用了 wrapper 元素,所以 inset 属性在那里不起作用。 是否可以在选择标签上使用内嵌框阴影? 最佳答案 我设法通过用 div 包装 se
我对 JQuery 和 inset Box-Shadow 有疑问。 首先我有一个输入框。 该字段具有以下 css 样式: #contact input[type="text"] { ba
我有一个名为 detailView 的 UIView,它有两个 subview ,一个名为 detailTextView 的 UITextView 和一个名为 detailImageView 的 UI
我一直在尝试在输入字段上使用 box-shadow: inset 0 0 0 5px rgba(26, 60, 88, 0.9); 但它似乎不起作用iOS。有解决办法吗? 谢谢 最佳答案 看起来这应该
我定义了一个 InsetDrawable,我希望能够在运行时调整 inset 的值,而无需重新分配另一个 drawable。 这可能吗?或者唯一的方法是重新创建 InsetDrawable? 最佳答案
我是一名优秀的程序员,十分优秀!