2017-06-12 3 views
1

in der Regel Symbole sind für Floating-Action-Buttons eingestellt, aber ich muss ein Bild, so dass ich ein kreisförmiges Bild, fügte es zum Projekt (mit Android Studio-> New - > image-Asset), aber das Bild nicht die gesamte Taste füllt haben:Floating Action Button Bild zum Füllen der Schaltfläche

enter image description here

mein xml:

<com.github.clans.fab.FloatingActionMenu 
    android:id="@+id/run_menu" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:paddingBottom="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:visibility="visible" 
    fab:fab_colorNormal="#DA4336" 
    fab:fab_colorPressed="#E75043" 
    fab:fab_colorRipple="#99FFFFFF" 
    fab:fab_shadowColor="#66000000" 
    fab:fab_showShadow="true" 
    fab:layout_constraintBottom_toBottomOf="parent" 
    fab:layout_constraintHorizontal_bias="0.0" 
    fab:layout_constraintLeft_toLeftOf="parent" 
    fab:layout_constraintRight_toRightOf="parent" 
    fab:layout_constraintTop_toTopOf="parent" 
    fab:layout_constraintVertical_bias="0.0" 
    fab:menu_backgroundColor="#ccffffff" 
    fab:menu_fab_label="Choose an action" 
    fab:menu_labels_colorNormal="#333333" 
    fab:menu_labels_colorPressed="#444444" 
    fab:menu_labels_colorRipple="#66FFFFFF" 
    fab:menu_labels_ellipsize="end" 
    fab:menu_labels_maxLines="-1" 
    fab:menu_labels_position="left" 
    fab:menu_labels_showShadow="true" 
    fab:menu_labels_singleLine="true" 
    fab:menu_openDirection="up" 
    android:layout_height="0dp" 
    android:layout_width="0dp"> 

    <com.github.clans.fab.FloatingActionButton 
     android:id="@+id/shop" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@mipmap/store" 
     fab:fab_label="Store" /> 

</com.github.clans.fab.FloatingActionMenu> 

Irgendwelche Ideen auf, wie man es beheben? Wie sollte es richtig gemacht werden? Thanks :)

+0

Ich würde die a fragen Uthor, aber anscheinend ist die Bibliothek aufgegeben. https://github.com/Clans/FloatingActionButton/issues – Zielony

Antwort

1

Legen Sie die folgende Eigenschaft für den FAB

android:scaleType="center"

wenn das nicht versuchen, funktioniert Eigenschaft mit

app:fabSize="mini"

+1

Android: scaleType = "Center" machte die Schaltfläche verschwinden App: fabSize = "Mini" hat nichts getan – Ago

0

Verwenden Sie den folgenden Code

android:scaleType="fitXY" 
+0

Es hat nicht funktioniert .. – Ago