android - Toolbar turns darker than normal while opening drawer -


while open drawer toolbar's colors turns way more darker color of rest of screen.

initially toolbar's background color white. ideas why happening ?

the code i'm using below :

<android.support.v4.widget.drawerlayout android:id="@+id/dl_poll_container" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:background="@color/white" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="false">  <linearlayout android:id="@+id/ll_toolbar_container"     android:orientation="vertical"     android:layout_width="match_parent" android:layout_height="wrap_content">      <android.support.v7.widget.toolbar android:id="@+id/tb_poll_toolbar"         android:gravity="center"         android:layout_width="match_parent" android:layout_height="wrap_content">          <textview             android:id="@+id/tv_poll_toolbar_title"             android:gravity="center" android:layout_gravity="center"             android:textsize="@dimen/text_size_xxxlarge" android:fontfamily="sans-serif"             android:textcolor="@color/black" tools:text="my title"             android:layout_width="wrap_content" android:layout_height="wrap_content" />      </android.support.v7.widget.toolbar>  </linearlayout>  <framelayout android:background="@color/white"     android:layout_margintop="?attr/actionbarsize"     android:layout_width="match_parent" android:layout_height="wrap_content">      <android.support.v4.view.viewpager         android:id="@+id/vp_poll_viewpager"         android:background="@color/white"         android:layout_width="match_parent"         android:layout_height="match_parent" />       <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         android:orientation="horizontal" android:layout_gravity="center_horizontal"         android:layout_margintop="48dp"         android:background="@drawable/background_line"         android:layout_width="144dp" android:layout_height="wrap_content">          <framelayout android:layout_width="36dp" android:layout_height="36dp"             android:layout_alignparentleft="true">              <imageview                 android:id="@+id/pager_img_one"                 android:layout_width="36dp" android:layout_height="36dp"                 android:scaletype="centerinside"                 app:srccompat="@drawable/ic_active_nav" />              <textview android:id="@+id/tv_poll_one"                 android:textstyle="bold"                 android:text="1" android:gravity="center"                 android:textcolor="@color/white"                 android:layout_width="36dp" android:layout_height="36dp" />          </framelayout>          <framelayout android:layout_width="36dp" android:layout_height="36dp"             android:layout_centerinparent="true">              <imageview                 android:id="@+id/pager_img_two"                 android:layout_width="36dp" android:layout_height="36dp"                 android:scaletype="centerinside"                 app:srccompat="@drawable/ic_deactive_nav" />              <textview android:id="@+id/tv_poll_two"                 android:visibility="invisible" android:textstyle="bold"                 android:text="2" android:gravity="center"                 android:textcolor="@color/white"                 android:layout_width="36dp" android:layout_height="36dp" />          </framelayout>          <framelayout android:layout_width="36dp" android:layout_height="36dp"             android:layout_alignparentright="true">              <imageview                 android:id="@+id/pager_img_three"                 android:layout_width="36dp" android:layout_height="36dp"                 android:scaletype="centerinside"                 app:srccompat="@drawable/ic_deactive_nav" />              <textview android:id="@+id/tv_poll_three"                 android:visibility="invisible" android:textstyle="bold"                 android:text="3" android:gravity="center"                 android:textcolor="@color/white"                 android:layout_width="36dp" android:layout_height="36dp" />          </framelayout>       </relativelayout>      <linearlayout android:orientation="vertical"         android:layout_width="match_parent" android:layout_height="wrap_content">          <linearlayout android:id="@+id/pb_container"             android:layout_width="match_parent" android:layout_height="8dp"             android:background="@android:color/transparent"             android:gravity="bottom">              <progressbar android:id="@+id/progress_bar"                 style="@style/widget.appcompat.progressbar.horizontal"                 android:progressdrawable="@drawable/progress_bar_drawable"                 android:indeterminate="false"                 android:max="100" android:progress="0"                 android:layout_width="match_parent" android:layout_height="8dp" />          </linearlayout>          <textview android:text="uploading video progress"             android:textcolor="@color/app_body_text_3" android:gravity="center_horizontal"             android:layout_width="match_parent" android:layout_height="wrap_content" />      </linearlayout>   </framelayout>  <android.support.design.widget.navigationview     android:id="@+id/nv_poll_navigation"     android:background="@color/white"     android:layout_width="wrap_content" android:layout_height="match_parent"     android:fitssystemwindows="false" android:layout_gravity="start" /> 

drawerlayout should have 2 children: main content view , navigation drawer. https://developer.android.com/training/implementing-navigation/nav-drawer.html#drawerlayout

so should wrap main content framelayout this:

<android.support.v4.widget.drawerlayout         android:id="@+id/dl_poll_container"         xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:app="http://schemas.android.com/apk/res-auto"         xmlns:tools="http://schemas.android.com/tools"         android:background="@color/white"         android:layout_width="match_parent" android:layout_height="match_parent"         android:fitssystemwindows="false">      <framelayout             android:layout_width="match_parent"             android:layout_height="match_parent">          <linearlayout android:id="@+id/ll_toolbar_container"                       android:orientation="vertical"                       android:layout_width="match_parent" android:layout_height="wrap_content">             ...         </linearlayout>          <framelayout android:background="@color/white"                      android:layout_margintop="?attr/actionbarsize"                      android:layout_width="match_parent" android:layout_height="wrap_content">             ....         </framelayout>     </framelayout>      <android.support.design.widget.navigationview             android:id="@+id/nv_poll_navigation"             android:background="@color/white"             android:layout_width="wrap_content" android:layout_height="match_parent"             android:fitssystemwindows="false" android:layout_gravity="start" />  </android.support.v4.widget.drawerlayout> 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -