android - Setting src and background for FloatingActionButton -
when use background , src in android.support.design.floatingactionbutton not set correctly. instead displayed as
<android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/pink" android:src="@drawable/ic_action_barcode_2" android:layout_gravity="bottom|right" android:layout_marginbottom="16dp" android:layout_marginright="16dp" />
but when use imageview appears correctly
<imageview android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/pink" android:src="@drawable/ic_action_barcode_2" android:layout_gravity="bottom|right" android:layout_marginbottom="16dp" android:layout_marginright="16dp" />
why floatingactionbutton not displayed correctly? should change in code?
floating action button's background not need changed, apply tint , add icon usual
<android.support.design.widget.floatingactionbutton ... app:backgroundtint="@color/ic_action_barcode_2" android:src="@drawable/ic_add" />
this provides round button still in colour desire. in case app
namespace used support library features:
xmlns:app="http://schemas.android.com/apk/res-auto"
Comments
Post a Comment