请假设一切只是针对目标而minSDK vesion只是棒棒糖.
我想要的是
我正在尝试从Play商店实现类似于以下屏幕的活动.
我在这里专注于英雄形象.如您所见,1.在状态栏后面绘制英雄形象.(完全透明.无保护)2.其余内容绘制在状态栏下方.(例如,工具栏/ ActionBar)3.滚动状态栏时会显示颜色.
我做了什么
我使用过来自GoogleIO app的ScrimInsetsFrameLayout.围绕此布局包裹我的英雄形象.在我的主题中添加了适当的样式.这就是我得到的
我需要帮助
我仍然对fitsSystemWindows标签感到困惑.当我在英雄图像布局上将其设置为"true"时,没有任何反应.这是状态栏是透明的,但图像是在状态栏下面绘制的.如果设置为"false",我会得到上面的结果.是否有一篇明确的文章解释了此标记的用法和幕后故事.
我将ScrimInsetFrameLayout上的"insetForeground"设置为透明.同样在主题中我将状态栏颜色设置为透明.但仍有图像保护.如何使状态栏完全透明.
请帮我指点或演示项目.如果我不清楚或需要更多信息,也请告诉我.
这对我有用。
布局.xml
<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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:fitsSystemWindows="true"
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"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/parallax_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
并在 styles.xml v-21 中设置statusBarColor透明颜色的属性
| 归档时间: |
|
| 查看次数: |
5926 次 |
| 最近记录: |