xml - Android:Background in styles lets elements disappear -


i changed android:background in style:

<style name="theme.app.base" parent="theme.appcompat.light.darkactionbar">     <item name="colorcontrolnormal">#747474</item>     <item name="colorcontrolactivated">@color/coloraccenttrans</item>     <item name="colorcontrolhighlight">@color/coloraccenttrans</item>      <item name="colorprimary">@color/colorprimary</item>     <item name="colorprimarydark">@color/colorprimarydark</item>     <item name="coloraccent">@color/coloraccent</item>      <item name="android:background">@color/background</item>  </style> 

and elements material calendar view seemed have lot visibility , can't figure out why.

here xml of fragment layout:

<relativelayout 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:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@color/background"     tools:context="io.rocketfox.dreamydiary.journalview">     <android.support.constraint.constraintlayout     android:id="@+id/layout_nothinginlist"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_alignparentleft="true"     android:layout_alignparentstart="true"     android:background="@color/background"     android:padding="0dp"     android:visibility="invisible"     tools:layout_editor_absolutex="0dp"     tools:layout_editor_absolutey="50dp">      <imageview         android:id="@+id/img_nodreamshint"         android:layout_width="167dp"         android:layout_height="115dp"         android:layout_marginbottom="8dp"         android:layout_marginend="8dp"         android:layout_marginleft="8dp"         android:layout_marginright="8dp"         android:layout_marginstart="8dp"         android:layout_margintop="8dp"         android:adjustviewbounds="false"         android:croptopadding="true"         android:scaletype="fitcenter"         app:layout_constraintbottom_tobottomof="parent"         app:layout_constrainthorizontal_bias="0.502"         app:layout_constraintleft_toleftof="parent"         app:layout_constraintright_torightof="parent"         app:layout_constrainttop_totopof="parent"         app:layout_constraintvertical_bias="0.39999998"         app:srccompat="@drawable/sheep" />      <textview         android:id="@+id/txt_nodreamshint"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginend="8dp"         android:layout_marginleft="8dp"         android:layout_marginright="8dp"         android:layout_marginstart="8dp"         android:text="no dreams yet"         android:textcolor="@color/splashscreenaction"         android:textsize="24sp"         app:layout_constraintleft_toleftof="parent"         app:layout_constraintright_torightof="parent"         app:layout_constrainttop_tobottomof="@+id/img_nodreamshint" />  </android.support.constraint.constraintlayout>  <relativelayout     android:id="@+id/layout_calendarpicker"     android:layout_width="match_parent"     android:layout_height="match_parent">      <com.prolificinteractive.materialcalendarview.materialcalendarview         android:id="@+id/calendarview"         android:layout_width="match_parent"         android:layout_height="wrap_content"         app:mcv_allowclickdaysoutsidecurrentmonth="true"         app:mcv_arrowcolor="@color/cardview_light_background"         app:mcv_datetextappearance="@style/customtextappearancedates"         app:mcv_firstdayofweek="monday"         app:mcv_headertextappearance="@style/customtextappearancemonth"         app:mcv_selectioncolor="@color/coloraccenttrans"         app:mcv_tilesize="40dp"         app:mcv_tilewidth="50dp"         app:mcv_weekdaytextappearance="@style/customtextappearanceweek"         tools:layout_editor_absolutex="8dp"         tools:layout_editor_absolutey="81dp" />      <listview         android:id="@+id/listdreams"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_alignparentbottom="true"         android:layout_alignparentleft="true"         android:layout_alignparentstart="true"         android:layout_below="@+id/calendarview"         android:background="@color/background" />  </relativelayout>  <relativelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:padding="8dp">      <android.support.design.widget.floatingactionbutton         android:id="@+id/fab_adddream"         style="@style/widget.design.floatingactionbutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentend="true"         android:layout_alignparentright="true"         android:clickable="true"         app:layout_constraintbottom_tobottomof="parent"         app:layout_constraintright_torightof="parent"         app:srccompat="@drawable/add" /> </relativelayout>  </relativelayout> 

the fab button visible thing left.

screenshot of layout after background change: http://imgur.com/elraxnw

  1. in style, should use android:windowbackground instead of android:background

windowbackground style properties effective when style applied theme activity or application , android:windowbackground attribute supports reference resource.

  1. only fab showing because container of fab relativelayout , width , height match_parent. that's why overlapped layout_calendarpicker.

update layout xml below:

<?xml version="1.0" encoding="utf-8"?> <relativelayout 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:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@color/background">      <android.support.constraint.constraintlayout         android:id="@+id/layout_nothinginlist"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_alignparentleft="true"         android:layout_alignparentstart="true"         android:background="@color/background"         android:padding="0dp"         android:visibility="invisible"         tools:layout_editor_absolutex="0dp"         tools:layout_editor_absolutey="50dp">          <imageview             android:id="@+id/img_nodreamshint"             android:layout_width="0dp"             android:layout_height="0dp"             android:layout_marginbottom="8dp"             android:layout_marginend="8dp"             android:layout_marginleft="8dp"             android:layout_marginright="8dp"             android:layout_marginstart="8dp"             android:layout_margintop="8dp"             android:adjustviewbounds="false"             android:croptopadding="true"             android:scaletype="fitcenter"             app:layout_constraintbottom_tobottomof="parent"             app:layout_constrainthorizontal_bias="0.502"             app:layout_constraintleft_toleftof="parent"             app:layout_constraintright_torightof="parent"             app:layout_constrainttop_totopof="parent"             app:layout_constraintvertical_bias="0.39999998"             app:srccompat="@drawable/sheep" />          <textview             android:id="@+id/txt_nodreamshint"             android:layout_width="0dp"             android:layout_height="0dp"             android:layout_marginend="8dp"             android:layout_marginleft="8dp"             android:layout_marginright="8dp"             android:layout_marginstart="8dp"             android:text="no dreams yet"             android:textcolor="@color/splashscreenaction"             android:textsize="24sp"             app:layout_constraintleft_toleftof="parent"             app:layout_constraintright_torightof="parent"             app:layout_constrainttop_tobottomof="@+id/img_nodreamshint" />      </android.support.constraint.constraintlayout>      <relativelayout         android:id="@+id/layout_calendarpicker"         android:layout_width="match_parent"         android:layout_height="match_parent">          <com.prolificinteractive.materialcalendarview.materialcalendarview             android:id="@+id/calendarview"             android:layout_width="match_parent"             android:layout_height="wrap_content"             app:mcv_allowclickdaysoutsidecurrentmonth="true"             app:mcv_arrowcolor="@color/cardview_light_background"             app:mcv_datetextappearance="@style/customtextappearancedates"             app:mcv_firstdayofweek="monday"             app:mcv_headertextappearance="@style/customtextappearancemonth"             app:mcv_selectioncolor="@color/coloraccenttrans"             app:mcv_tilesize="40dp"             app:mcv_tilewidth="50dp"             app:mcv_weekdaytextappearance="@style/customtextappearanceweek"             tools:layout_editor_absolutex="8dp"             tools:layout_editor_absolutey="81dp" />          <listview             android:id="@+id/listdreams"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:layout_alignparentbottom="true"             android:layout_alignparentleft="true"             android:layout_alignparentstart="true"             android:layout_below="@+id/calendarview"             android:background="@color/background" />          <android.support.design.widget.floatingactionbutton             android:id="@+id/fab_adddream"             style="@style/widget.design.floatingactionbutton"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_marginright="16dp"             android:layout_marginbottom="16dp"             android:layout_alignparentbottom="true"             android:layout_alignparentend="true"             android:layout_alignparentright="true"             android:clickable="true"             android:src="@drawable/add" />      </relativelayout> </relativelayout> 

hope help~


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -