【发布时间】:2015-12-07 08:42:20
【问题描述】:
我正在尝试使用透明状态栏和通用壁纸制作活动。问题是状态栏和活动试图绘制不同的背景,每个背景都会导致图像破旧。
主题 xml:
fitssystemWindows - true
statusBarColor - @android:color/transparent
background - @drawable/backdrop
稍后我将使用精确的 XML 进行编辑。
图片(此处无法上传图片):https://drive.google.com/file/d/0B4QbRXVog08OY1doazJmaTNoeGs/view?usp=docslist_api
EDIT 1:尝试使用下面建议的解决方案,仍然无法正常工作
主题 xml:
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/backgroundIV"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/backdrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"/>
此时应用程序如下图所示: http://drive.google.com/file/d/0B4QbRXVog08OX25Ib1kteDJvazQ/view?usp=sharing
更新工作代码:
主题 xml -
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:fitsSystemWindows">true</item>
<item name="android:background">@drawable/backdrop</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
活动布局xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
【问题讨论】:
标签: android android-5.0-lollipop material-design