android


android:Elevation not respected across FragmentTransactions


So I have a layout which looks similar to the following:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_height="wrap_content"
android:elevation="4dp"
android:background="?attr/colorPrimary"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"/>
<FrameLayout
android:id="#+id/content"
android:layout_below="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
This forms my base layout file for my activity and then I swap out the FrameLayout for various fragments. One such fragment has a layout like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<SlidingTabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:elevation="4dp"
android:layout_height="wrap_content"/>
<android.support.v4.view.ViewPager
android:id="#+id/profileViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/sliding_tabs"
android:background="#android:color/white"/>
<FloatingActionButton
android:id="#+id/floatingButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"/>
</RelativeLayout>
I would expect that as I have set the elevation of both the Toolbar and the SlidingTabLayout to be 4dp, that the toolbar would not cast a shadow on the tabs, however it does:
Ideally I wouldn't want to be setting the elevation of the Toolbar in code - does anyone know if there is a way to prevent the Toolbar casting a shadow? I would have assumed that as both views are at 4dp elevation, even though they aren't in the same layout, no shadow would be cast.
Thanks for the help.
Shadows respect the elevation of siblings, but not cousins. The action bar and the SlidingTabLayout are not siblings, so the action bar casts a shadow on the SlidingTabLayout.
You'll need to customize the action bar to remove the elevation if you don't want the shadow.

Related Links

ActivityNotFoundException unable to find explicit activity class MediaProjectionPermissionActivity [duplicate]
LocalBroadcastManager not receiving broadcasts in a Activity
Libstreaming record video via the server side and also streaming live video in same time
Why is it not possible to connect Android directly with Oracle [duplicate]
What is the maximum blink rate of led flashlight in an android phone? [closed]
Appcelerator , can not change tabsBackgroundColor in android
Google Maps makes the app stop Unfortunately
FragmentStatePagerAdapter cannot update viewpager's view
IllegalArgumentException: button doesn't exist 0 in android studio 2.1 on ubuntu 14.04
How to set the differenet intent in GCMListenerService?
AlertDialog - Unable to add window - Android?
ChromeSwipeLayout onItemSelected?
Why shared element transition make transparent Activity blank?
App Indexing with a ViewPager that pages fragments
How do I identify and import only specific libraries from Google Play Services?
heroku H12 error with Volley

Categories

HOME
sonarqube
django
grok
porting
fpga
rdbms
angular-formly
apache-spark-mllib
jwplayer
package
solver
cublas
interpolation
echo
pkcs#11
arangodb
vimdiff
openpyxl
gson
android-securityexception
resultset
jsonpath
automatic-ref-counting
speech-synthesis
qsqlquery
capistrano3
wolframalpha
nim
selinux
simpleitk
squashfs
object-storage
scriptella
froala
expressionengine3
opentk
syntax-highlighting
pylons
browser-sync
finagle
ntp
powershell-ise
weather
turfjs
nested-lists
watchman
openalpr
xdocreport
metawidget
hackintosh
numberpicker
print-css
claims
tcc
oim
getchar
builder
manova
insight
cup
reshape
vcloud-director-rest-api
redbeard-ios
pacemaker
segment-io
synonym
dimension
clipboard.js
piracy-prevention
dynamics-nav-2016
opl
forwarding
coda
liquid-layout
botan
dnssec
actionfilterattribute
openbabel
document-repository
browserify-shim
structuremap3
universal-image-loader
tweenlite
grails-plugin-rabbitmq
alice
fragmenttransaction
vfs
listitem
fusefabric
jsr286
node-redis
gobject-introspection
photolibrary
resharper-6.0
vs-android
maven-1
hbm2java
cfwindow
strtod
lobo-cobra
leader
commercial-application

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App