Ishan
Ishan

Reputation: 3395

Floating action button displays png differently?

Floating Action Button shows a png different than what it is.

Here is the same image used in an ImageView with background set as null png in an ImageView

Here is the same png image but used in a FloatingActionButton same png in a FloatingActionButton

This is weird, can someone explain why is this happening ? And how to fix it ?

UPDATE: Here are the layout files for the same

ImageButton

...............
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/submit_button"
            android:layout_gravity="center_horizontal"
            android:id="@+id/mobile_number_submit_button"
            android:background="@null"/>
......................

FloatingActionButton

.......................
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/otp_submit_floating_action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/submit_button" />
.......................

Upvotes: 0

Views: 2442

Answers (2)

Dario Picco
Dario Picco

Reputation: 177

I think is not a good idea to put an image with a colored circle inside an floating action button because it is already a colored circle button so you need to put an image icon with only the icon with transparent background (in your case an arrow ">" without the colored circle that is provided by the floating action button itself)

Upvotes: 0

Zahidul Islam
Zahidul Islam

Reputation: 3190

FloatingActionButton set the accent color by default. So you need to make the icon transparent and everything will be fine .

Upvotes: 1

Related Questions