【发布时间】:2015-05-10 20:04:54
【问题描述】:
我希望在我的应用程序中能够实现这种效果:
状态栏是半透明的,布局在状态栏的后面。我读过的关于该主题的每个示例都主要与导航抽屉相关联,并且主要使用 ScrimInsetScrollView(或 ScrimInsetsFrameLayout)。我尝试使用 ScrimInsetsFrameLayout 来实现它。
基本上我有一个包含片段的活动,这是我的布局(片段稍后在活动的 onCreate 方法中添加到容器中):
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
>
<com.test.app.widget.ScrimInsetsFrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:insetForeground="#4000"
android:id="@+id/container"
></com.test.app.widget.ScrimInsetsFrameLayout>
</FrameLayout>
而且我还在主题中将 android:statusBarColor 设置为透明。 该解决方案对我不起作用。显然我在这里做错了什么。 有人能指出我错在哪里吗?
【问题讨论】:
-
现在,使用新设计支持库 (v23) 中的组件可以轻松实现此效果
标签: android android-5.0-lollipop transparent statusbar