Why does FAB appear different on different Android devices/OS versions?

Can anyone tell me why exactly the same image (same image resource file as PNG, and same XML definition below) looks perfect on Android 5.1 and 7.1.1 (the image above) but bad on Android 4.1 (the image below).

<img src=https://www.e-learn.cn/content/wangluowenzhang/"https://i.stack.imgur.com/B5zeh.png" alt="enter image description here">

The above image appears perfect on: Samsung real device 5.1 Pixel API 25 (7.1.1) emulator

The below image looks bad on: Samsung real device 4.3 Nexus One API 18 4.2 emulator

The XML code:

<android.support.design.widget.FloatingActionButton android:id="@+id/myFAB" android:layout_width="75dp" android:layout_height="75dp" android:layout_gravity="center|bottom" android:layout_margin="@dimen/fab_margin" android:visibility="invisible"/>

Please advice how can I fix this problem.

EDIT: the images were generated from Android Studio "New Image Asset" and different resolutions (hdpi, mdpi, xhdpi, xxhdpi) has indeed been generated.


FloatingActionButton cannot take any width/height. app:fabSize parameters specifies 3 sizes for the fab: auto, mini, and normal.

Leave layout_width and layout_height as wrap_content, and specify the desired fab size using app:fabSize="normal" (or other parameter from the list).


  • how to make round image border to imageview programatically android [closed]
  • repeating animation with Timer
  • Maven deploy secondary file to repository
  • How rooting is achieved programmatically?
  • Did back key destroy an activity?
  • Sticky Footer Below ListView in Android Layout
  • Overlapping ImageView in RelativeView
  • Cannot establish BLE connection between Android 5 and BLE device
  • Ansible sudo hangs after 5 tasks
  • Fail SonarQube quality gate when coverage decreases
  • Objective-C : getting error on console while trying to display app on ipad device?
  • Android NDK vs iOS - performance issue [closed]
  • How to set the navigation bar to the top in Table View?
  • Partial specialization of a class template in derived class affects base class
  • Two Tables Serving as one Model in Rails
  • Can I programmatically choose the Android layout folder?
  • JqueryMobile Popup menu is not working
  • Sonar maven jacoco code coverage for Multimodule project
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Hardware Accelerated Image Scaling in windows using C++
  • Disable Enter in editText android
  • Cannot resolve symbol 'MyApi'
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • How do i call multiple functions using if statements that have multiple parameters in C++
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Controls, properties, events and timers running in design time
  • Can I make an Android app that runs a web view in Chrome 39?
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Release, debug version and Authorization Google?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to include full .NET prerequisite for Wix Burn installer
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal