Fragmento interno con fitsSystemWindows
Estoy trabajando en la barra de estado transparente y la barra de navegación inferior visible. He logrado lo mismo con mi última pregunta: Barra de estado gradual con BottomNavigationView
Pero ahora, tengo fragmentos en los quefitsSystemWindows
no está trabajando. Tengo un diseño como Actividad -> Visor -> Fragmentos -> Visor -> Fragmentos secundarios.
He pasado por muchos intentos de desbordamiento de pila, pero aún no tuve suerte:
Appbar fitsSystemWindows - Dentro de un ViewPagerAndroid - ViewPager fitsSystemWindows (pantalla completa) no funcionaConfigurar una vista secundaria para que se ajuste a las ventanas del sistemaAndroid encajaSystemWindows no funciona al reemplazar fragmentos¿Cómo aplicar el gradiente a la barra de estado en Android?He agregado esta estilos :
<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:navigationBarColor">#000</item>
<item name="colorControlNormal">#FFFFFF</item>
<item name="colorPrimaryDark">@android:color/transparent</item>
En v21 / estilo:
<item name="colorPrimaryDark">@android:color/transparent</item>
Diseño, he agregadofitsSystemWindows
a cada fragmento, así como a la actividad.
Diseño de actividad:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.mobile.lendlease.views.WrapContentViewPagerBottomTab
android:id="@+id/viewPagerContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/viewDivider"
android:fitsSystemWindows="true" />
<View
android:id="@+id/viewDivider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_above="@+id/bottomNavigation"
android:background="@color/default_border" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingBottom="@dimen/margin_12"
android:paddingEnd="@dimen/margin_12"
android:paddingStart="@dimen/margin_10"
android:paddingTop="@dimen/margin_10"
app:itemBackground="@color/white"
app:menu="@menu/navigation" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
</layout>
Uno de diseño de fragmento:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbarLayout"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorScreenBackground"
android:focusable="true"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
android:layout_marginBottom="@dimen/margin_20"
android:background="@drawable/toolbar"
android:gravity="bottom"
android:fitsSystemWindows="true"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/margin_18">
<ImageView
android:id="@+id/ivHome"
android:layout_width="159dp"
android:layout_height="29dp"
android:scaleType="centerInside"
android:src="@drawable/logo" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivSearch"
android:layout_width="@dimen/margin_47"
android:layout_height="32dp"
android:contentDescription="@string/app_name"
android:scaleType="fitXY"
android:src="@drawable/ic_search" />
<TextView
android:id="@+id/ivMall"
style="@style/notoSansSemiBoldStyle"
android:layout_width="58dp"
android:layout_height="32dp"
android:layout_marginEnd="@dimen/margin_18"
android:layout_marginStart="@dimen/margin_10"
android:background="@drawable/search_bg_shape"
android:gravity="center"
android:text="@string/mall_all"
android:textAllCaps="false"
android:textColor="@color/gradient_card_color1"
android:textSize="@dimen/font_12"
, android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:minHeight="?attr/actionBarSize"
app:tabBackground="@drawable/tab_indicator_line_selected"
app:tabGravity="center"
app:tabIndicatorColor="@android:color/transparent"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorBlackLight"
app:tabTextAppearance="@style/themeTabText"
app:tabTextColor="@color/colorBlackLight" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPagerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</layout>