2016-05-18 15 views
1

Ich habe Schwimmens mit diesem Code verwendetFloating-Action-Button in API 21 und höher nach unten ausgerichtet?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".menuscreens.AllRecipientsActivity"> 

    <GridView 
     android:gravity="center" 
     android:numColumns="3" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/gridViewRecipients" 
     /> 

    <android.support.design.widget.FloatingActionButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:layout_marginTop="@dimen/action_button_margin" 
     android:layout_marginBottom="@dimen/action_button_margin" 
     android:layout_marginRight="@dimen/action_button_margin" 
     android:layout_marginEnd="@dimen/action_button_margin" 
     android:layout_marginLeft="@dimen/action_button_margin" 
     android:src="@android:drawable/ic_input_add" 
     android:tint="#fff" 
     android:id="@+id/fabAddMoreRecipients" 
     android:layout_gravity="bottom|right" 

     /> 

</RelativeLayout> 

Grundsätzlich ist mein Problem in API 21, dass und über ihm von unten

und zwei Screenshots, die man von Bluestack API nicht-Marge wird immer ist 23 19 ist und die zweite API MotoG

API 19 bluestack

API 23 MotoG

+0

try android: layout_marginBottom und android: layout_marginLeft – Manifest

+0

nein, es hat nicht funktioniert –

Antwort

0

Versuchen Sie, diese Eigenschaft

android:layout_gravity="bottom|right" 
1

Verwenden app:useCompatPadding="true" wie unten

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:src="@drawable/icon_add_place" 
    app:backgroundTint="@color/colorPrimary" 
    app:fabSize="normal" 
    app:useCompatPadding="true"/> 
Verwandte Themen