I am trying to get a completely transparent (NOT translucent) status bar in Android 5.0+. While landscape work fine with the image occupying the whole screen, except the navigation bar, portrait sets the status bar color to app_main_accent (the same as image background) and the image occupies the rest of the screen. I am using the same layout file for both portrait and landscape and the results are different. I have tried cleaning and rebuilding the project with the same result. Please help me get it working. Thank you.
Support library version: 23.3.0
my manifest:
<activity
android:name=".Activities.ActivityDetails2"
android:theme="@style/AppTheme.TransparentTitleBar"
>
</activity>
then v21/styles.xml:
<style name="AppTheme.TransparentTitleBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
activity:
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v7.app.AppCompatActivity;
import com.jgarin.R;
import com.jgarin.core.db.DBElements.BaseGroupElement;
public class ActivityDetails2 extends AppCompatActivity {
public static final String ITEM_KEY = "itemKey";
private BaseGroupElement item;
public static Intent getLaunchIntent(final Context context, final BaseGroupElement item) {
Intent intent = new Intent(context, ActivityDetails2.class);
intent.putExtra(ITEM_KEY, (Parcelable) item);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details2);
item = getIntent().getParcelableExtra(ITEM_KEY);
}
}
and layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator"
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"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_main_accent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="@drawable/material_flat"
/>
<android.support.design.widget.AppBarLayout
android:id="@+id/main.appbar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@android:color/transparent"
android:fitsSystemWindows="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/main.collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@android:color/transparent"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:statusBarScrim="@android:color/transparent"
>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>