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

Phonegap: Open a URL in default browser
Android app not working in kitkat version but working in lesser versions
How to save the accelerometer data into log files in android?
Android ant get copied files path
open App from google calendar Android
Auto Page Refresh/Reload function android
Android Media palyer by FFmpeg2.3.3 and SDL2-2.0.3 has a error when SDL_init().The error is about SDL_main.h
Unable to display AlbumArt in RemoteMediaController while casting from sender
Android spinner prompt
How to finish activity from service class in android?
Can't i add android-17,android-18 etc platforms in android studio?
RSA Publickey implemenation in android
What i should write in Pro-guard Files to stop reverse engineering android?
CreateProcess error=206, The filename, or extension is too long
GPS code returning last location
User Defined Target in Rajwali-Vuforia

Categories

HOME
kentico
adal
awk
codenvy
webdriver
character-encoding
angular2-material
powerpoint
jwplayer
shiro
settings
python-multithreading
iis-6
retrofit2
opengl-3
octave
text-mining
startup
filechannel
php-5.6
endpoint
speech-synthesis
shared-libraries
selectize.js
linear-algebra
glyphicons
microsoft-dynamics-nav
firefox-addon
foreign-keys
topology
postscript
parcelable
flask-sqlalchemy
itunes
paperjs
sqlpackage
nsurl
constexpr
send
dst
kudu
paragraph
testbed
github3.py
lint
apns-php
azure-arm
doc
odoo-website
apriori
plr
drupal-theming
stylecop
opencmis
double-click
ovf
spring-data-couchbase
opengl-4
lsyncd
sandcastle
reachability
materialized-path-pattern
smartfoxserver
centrifuge
myspace
simevents
spreadjs
aurora
upx
jaunt-api
dynamics-nav-2016
oracle-spatial
lazybones
android-launcher
pax-exam
dnssec
adehabitathr
ejb-2.x
cosine-similarity
execve
paw
raygun
reflector
clickbank
amslidemenu
sbcl
notorm
dtmf
beaker-testing
scmmanager
dolby-audio-api
server-administration
apache-abdera
argouml
nokia-s40
update-statement
cgbitmapcontextcreate
socketserver
aspmenu
spread
strtod
lalr
asynchronous-wcf-call
soappy
blind
netbeans6.1

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