1

I would like to replace the circle of the floating action button by a drawable, I'm using this fab fab on github I'm using this fab cause it work with SDK 14

It's the xml file :

      <com.getbase.floatingactionbutton.FloatingActionsMenu
            android:id="@+id/multiple_actions_saisiev2"
            android:layout_width="179dp"
            android:layout_height="368dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="false"
            fab:fab_addButtonColorNormal="@color/dull_yellow"
            fab:fab_addButtonColorPressed="@color/dull_yellow"
            fab:fab_addButtonPlusIconColor="#182740"

            android:layout_marginBottom="100dp"
            android:layout_marginRight="30dp">

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/fab_contre"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/vert_fab"
                fab:fab_title="@string/contre"
                fab:fab_addButtonPlusIconColor="#FFFFFF"
                fab:fab_colorPressed="@color/vert_fab"/>

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/fab_perte"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/vert_fab"
                fab:fab_title="@string/perte"
                fab:fab_addButtonPlusIconColor="#FFFFFF"
                fab:fab_colorPressed="@color/vert_fab"/>

        </com.getbase.floatingactionbutton.FloatingActionsMenu>

If I use android:background it's not working, and If I change the background in the JAVA, the png appears on the background of the button. I try to modifiy the library but nothing appears when I try to modify some thing.

Thanks

Vodet
  • 1,491
  • 1
  • 18
  • 36

1 Answers1

1

I guess this should help... the native use of Floating Action Button to set drawable attribute to it is like this.

android:src="@android:drawable/ic_dialog_email"

native fab icon

or from the library you are using, check the implementation

fab:fab_icon="@drawable/ic_fab_star"

Output enter image description here

Pankaj Nimgade
  • 4,529
  • 3
  • 20
  • 30
  • Thank for you answer but the fab:fab_icon not work nothing appears, and I try the first one but I try to add my png in the folder where the @android:drawable/ go to but he can't find my png – Vodet Feb 01 '16 at 18:25
  • @VaudeyBaptiste, they have specific size make sure you do have those sizes, 64*64 for xhdpi, 48*48 for hdpi, 32*32 mdpi and 24*24 for ldpi – Pankaj Nimgade Feb 01 '16 at 18:27
  • ok thanks and I don't know if I put the img in the good folder I go to : AppData\Local\Android\sdk\platforms\android-23\data\res and I got a lot of drawable folder I need to put the img in every folder ? – Vodet Feb 01 '16 at 18:37
  • you don't have to put images for android-plaform they can be accessed directly like this, "@android:drawable/ic_dialog_email", but when you want some of custom images you would have to put those size images in your project with respective drawable directory – Pankaj Nimgade Feb 01 '16 at 18:41
  • yes but I would like to use a picture that I have create – Vodet Feb 01 '16 at 18:45
  • in that case you need to make different size for that image as i mentioned and need to put them in respective directories – Pankaj Nimgade Feb 01 '16 at 18:46