0

Tried to remove border and background, but I still see shadow:

enter image description here

Where do I remove the shadow of a float button?

Here's the app running on Android Studio Emulator:

preview

markzzz
  • 47,390
  • 120
  • 299
  • 507
  • You should copy/paste the XML code here as text. Also, show a screenshot of the app running on a device and explain what you want to change in how it looks. – Code-Apprentice Feb 21 '23 at 16:27
  • LMK if the link I added at the top answers your question. – Code-Apprentice Feb 21 '23 at 16:29
  • @all I see the shadow around the circle, I want to remove it... – markzzz Feb 21 '23 at 16:32
  • Tried all on https://stackoverflow.com/questions/30613921/how-to-remove-floatingactionbuttons-surrounding-shadow, can't resolve it. – markzzz Feb 21 '23 at 16:35
  • Well, you might give the `elevation="0dp"` suggestion a shot, but it might not remove the shadow completely, 'cause a `Button`'s `stateListAnimator` modifies its elevation during a click, so you might still see the shadow when its pressed down. That's why I usually suggest the `stateListAnimator` one for `Button`s. I'll spin up a test here in a minute. – Mike M. Feb 21 '23 at 16:35
  • @MikeM. can't be able to place Button "over" Toolbar (within a Relative Layout) – markzzz Feb 21 '23 at 16:38
  • I'm not sure what you mean, but `FloatingActionButton`'s default style apparently does have an explicit `elevation` set, so you'd have to set it to `0dp`, too. (I could've sworn it didn't, but I must be misremembering. Sorry 'bout that.) Alternatively, you could set `android:outlineProvider="none"` and keep the `elevation`, but I'm not sure if that'll cause any problems with FAB's draw, visually. – Mike M. Feb 21 '23 at 16:50
  • 1
    Yeah, `android:outlineProvider="none"` seems to work just fine. I can't do video atm, but here's a screenshot of two FABs side by side, with the right one pressed down: https://i.stack.imgur.com/mNTqG.png. – Mike M. Feb 21 '23 at 17:06
  • Basically, if I place a button after a Toolbar, its hidden. So I want it "over" the Toolbar, and FloatingActionButton seems to do it. – markzzz Feb 21 '23 at 18:25
  • 1
    @MikeM. android:outlineProvider="none" seems to works. Thanks – markzzz Feb 21 '23 at 18:25
  • Is there a reason you are putting a FAB after the toolbar rather than adding menu items directly to the toolbar? See https://developer.android.com/develop/ui/views/components/appbar/setting-up and https://stackoverflow.com/questions/35648913/how-to-set-menu-to-toolbar-in-android for how to do this. – Code-Apprentice Feb 21 '23 at 18:36
  • @MikeM. if you place an answer, I'll give you the accepted one! thanks – markzzz Mar 08 '23 at 09:16
  • Oh, I'm good. :-) Nothin' huge. Thanks, though; appreciate the offer. Cheers! – Mike M. Mar 08 '23 at 09:19

0 Answers0