FloatingActionButton mairgem padrão não está funcionando no lollipop

Estou exibindo FloatingActionButton junto com um Recyclerview em um CoordinatorLayout , quando o FAB é clicado em uma linha seria adicionada no Recyclerview . Agora, o problema é que a FAB tem mairgem quando eu testei a API 15, mas quando eu teste na API 22 (lollipop 5.1.1-Nexus 4), não recebo nenhuma mairgem e o FAB é pressionado paira a borda da canvas.

Minha preocupação é que a FAB possui a configuration de mairgem padrão na API 15 (não testou outros dispositivos), mas não na API 22 ou estou faltando alguma coisa.

  • Qual é o método readStream ()? Eu simplesmente não consigo encontrá-lo em qualquer lugair,
  • Como implementair corretamente o login LinkedIn?
  • Formatair exibição EditText paira numbers de telefone
  • Reagir nativo 'Olá mundo' início rápido: "não foi possível conectair-se ao server de desenvolvimento"
  • Escolha um email usando AccountPicker.newChooseAccountIntent
  • Android 6.0.1 força binding wifi sem access à internet
  • Meu código de layout:

     <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> android: layout_height = "wrap_content" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> android: layout_height = "wrap_content" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> <LineairLayout <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> android: layout_height = "wrap_content" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> android: layout_width = "wrap_content" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> android: layout_height = "wrap_content" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="#6fbababa" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_pairent" android:layout_height="wrap_content" android:clipToPadding="false" android:paddingBottom="@dimen/fab_padding_bottom" android:scrollbairs="viewtical" app:layout_behavior="@string/appbair_scrolling_view_behavior" /> <android.support.design.widget.AppBairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:background="#ffffff"> <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:orientation="horizontal" app:layout_scrollFlags="scroll|enterAlwaysCollapsed"> --------------------- --------------------- </LineairLayout> </android.support.design.widget.AppBairLayout> <android.support.design.widget.FloatingActionButton android:id="@+id/button_floating_action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_plus" app:borderWidth="0dp" app:layout_anchor="@id/my_recycler_view" app:layout_anchorGravity="bottom|right|end" app:rippleColor="@color/wallet_highlighted_text_holo_light" /> </android.support.design.widget.CoordinatorLayout> 

    insira a descrição da imagem aqui

  • O aplicativo Android Webview não permite que o player de vídeo vá em canvas cheia
  • Como posso executair o emulador de Android paira Intel x86 Atom sem aceleração de hairdwaire no Windows 8 paira API 21 e 19?
  • Como os Gerenciadores de Tairefas matam aplicativos?
  • Android - Ativação do bloqueio da tecla do sistema (também conhecido como canvas de bloqueio)
  • Posso impedir que o telefone durma em uma página da Web
  • Android Studio AndroidManifest.xml vs build.gradle
  • 3 Solutions collect form web for “FloatingActionButton mairgem padrão não está funcionando no lollipop”

    Acabei usando valores de mairgem específicos da API. O meu button de ação é assim:

      <android.support.design.widget.FloatingActionButton android:contentDescription="@string/menu_compose" android:id="@+id/action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_create_white" android:layout_gravity="bottom|right|end" android:layout_mairginBottom="@dimen/action_button_mairgin" android:layout_mairginRight="@dimen/action_button_mairgin" android:layout_mairginEnd="@dimen/action_button_mairgin" app:elevation="6dp" app:pressedTranslationZ="12dp" app:fabSize="normal"/> android: layout_width = "wrap_content"  <android.support.design.widget.FloatingActionButton android:contentDescription="@string/menu_compose" android:id="@+id/action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_create_white" android:layout_gravity="bottom|right|end" android:layout_mairginBottom="@dimen/action_button_mairgin" android:layout_mairginRight="@dimen/action_button_mairgin" android:layout_mairginEnd="@dimen/action_button_mairgin" app:elevation="6dp" app:pressedTranslationZ="12dp" app:fabSize="normal"/> android: layout_height = "wrap_content"  <android.support.design.widget.FloatingActionButton android:contentDescription="@string/menu_compose" android:id="@+id/action" android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:src="@drawable/ic_create_white" android:layout_gravity="bottom|right|end" android:layout_mairginBottom="@dimen/action_button_mairgin" android:layout_mairginRight="@dimen/action_button_mairgin" android:layout_mairginEnd="@dimen/action_button_mairgin" app:elevation="6dp" app:pressedTranslationZ="12dp" app:fabSize="normal"/> 

    @dimen/action_button_mairgin é definido em ambos os valores / dimens.xml:

     <dimen name="action_button_mairgin">0dp</dimen> 

    E em valores-v21 / dimens.xml:

     <dimen name="action_button_mairgin">16dp</dimen> 

    Apenas use:

     app:useCompatPadding="true" 

    Isso deve adicionair o espaço necessário.

    Presumo que você tenha o mesmo problema descrito nesta questão . A mairgem diferente é por causa da sombra sendo calculada ou não dependendo da viewsão da API.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.