Android FloatingActionButton Support Library - populating on devices with a pre-lobe?

This is my definition of FAB:

<android.support.design.widget.FloatingActionButton android:id="@+id/button_capture_action_show_options" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_margin="16dp" android:focusable="true" android:src="@drawable/c" 

It seems that an additional addition has been added when rendering on devices with a preliminary leoptype, and I canโ€™t remove them.

Lollipop render:

lollipop

Pre-Lellipop Rendering:

pre-lollipop

Any suggestions are greatly appreciated.

+5
source share
2 answers

This is due to how FAB implements the add-on in pre-Lollipop devices.

I donโ€™t know how to remove it on pre-Lollipop, but you can make it consistent (i.e. increase the indentation on Lollipop and up) by setting app:useCompatPadding="true" in FAB in the layout definition or using setUseCompatPadding .

It behaves this way because of the way it draws shadows.

+3
source

So I still donโ€™t know if there is an โ€œofficialโ€ way to do this, but in the end I did the following:

  if (!isLollipopAndAbove()) { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tab.getLayoutParams(); params.setMargins(0, 0, 0, 0); tab.setLayoutParams(params); } 

oh and yes, it was a non-supplemented field that needed to be changed

0
source

Source: https://habr.com/ru/post/1233243/


All Articles