使用状态栏和底栏折叠工具栏问题。 Fitssystemwindows =“true”无效

时间:2017-10-12 16:07:49

标签: android

我无法使用Collapsing工具栏和嵌套ScrollView来使用我的CoordinatorLayout。

在CoordinatorLayout之外的任何设置上设置fitssystemwindows =“true”没有或有负面影响。 App Theme具有属性

<item name="android:windowTranslucentStatus">true</item>

使状态栏透明。

我的问题是: 1.图像向下滚动太远,以便半透明状态栏采用蓝色工具栏颜色(当工具栏未100%展开时,ImageView可见)。 enter image description here enter image description here

  1. 系统的Bottom Bar隐藏了我的NestedScrollView的一部分。 enter image description here
  2. 这是我的布局:

    <android.support.design.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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.example.application.collapsingtoolbarexample.MainActivity">
    
    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">
    
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/goslings"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax" />
    
            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"/>
    
        </android.support.design.widget.CollapsingToolbarLayout>
    
    </android.support.design.widget.AppBarLayout>
    
    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#dfdddd"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingTop="10dp"
            >
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
            <include layout="@layout/card_layout" />
    
    
        </LinearLayout>
    
    </android.support.v4.widget.NestedScrollView>
    

1 个答案:

答案 0 :(得分:0)

您需要适合系统窗口(工具栏除外),同时在图像上设置高度而不是CollapsingToolbar

Sub Test()
    Dim primerRescateCP As Long

    'Initialize the result to whatever it should be in case of error.
    primerRescateCP = 0

    'Attempt to get the actual value.
    'If the attempt fails, it will be on the right hand side, before the assignment,
    'leaving the variable untouched.
    With Application.WorksheetFunction
        On Error Resume Next
        primerRescateCP = .Match(.VLookup("RescateCartera Propia", Range("B:B"), 1, 0), Columns(2), 0)
        On Error GoTo 0
    End With

    'Display the result.
    MsgBox primerRescateCP
End Sub

所以最终的代码是

android:fitsSystemWindows="true"