I just started to use the new Deisgn library from Google : 'com.android.support:design:22.2.0'
I use the FloatingActionButton and I have a small issue between Android below 5.0 and over 5.0. Watch the screenshot :
Android 4.4 :
Android 5.0 :
As you can see, on Android 4.4, there is a margin around the FAB. I think this is for displaying the shadow. But IT'S OVERSIZED ! So is it a bug (or a forget of Google) or just the normal behavior ?
The xml of the view hosting he fabs :
<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"
tools:context="fr.freemo.freemo.activities.ListFreemoCityActivity">
<include
android:id="@+id/toolbar"
layout="@layout/view_toolbar" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar">
</FrameLayout>
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/margin_fab"
android:layout_marginRight="@dimen/margin_fab"
android:elevation="@dimen/fab_elevation_lollipop"
android:src="@drawable/ic_action_new"
app:backgroundTint="@color/color_app"
app:fab_type="normal" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_display"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/fab_add"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/margin_fab"
android:layout_marginRight="@dimen/margin_fab"
android:elevation="@dimen/fab_elevation_lollipop"
android:src="@drawable/ic_map_white"
android:tint="@color/color_app"
app:backgroundTint="@color/white"
app:fab_type="normal" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_display_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/fab_display"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/margin_fab"
android:layout_marginRight="@dimen/margin_fab"
android:elevation="@dimen/fab_elevation_lollipop"
android:src="@drawable/ic_action_list"
android:tint="@color/color_app"
android:visibility="invisible"
app:backgroundTint="@color/white"
app:fab_type="normal" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_display_grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/fab_display_list"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/margin_fab"
android:layout_marginRight="@dimen/margin_fab"
android:elevation="@dimen/fab_elevation_lollipop"
android:src="@drawable/ic_view_module_white"
android:tint="@color/color_app"
android:visibility="invisible"
app:backgroundTint="@color/white"
app:fab_type="normal" />
</RelativeLayout>
The Design Support library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and tabs. The Gradle build script dependency identifier for this library is as follows: com. android. support:design:28.0.
Update the Android Support LibraryIn Android Studio, click the SDK Manager icon from the menu bar, launch standalone SDK Manager, select Android Support Repository and click “Install x packages” to update it. Note you will see both Android Support Repository and Android Support Library listed in the SDK Manager.
The AndroidX library contains the existing support library and also includes the latest Jetpack components.
It was an issue (check a bug report created by me: https://code.google.com/p/android/issues/detail?id=175330) and should be fixed in the future release of the support-design library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With