Showing posts with the label button

Using Extended Floating Action Button

You may have seen gmail app where fab button expand and collapse as you scroll. fab button has been already there for some time new api extended dab button was added some time back. to use extended fab button you need to use simplest implementation looks like below : < android:id="@+id/floating_action_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:layout_marginEnd="24dp" android:layout_marginBottom="24dp" android:contentDescription="fab button" android:text="Add Button" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:icon="@drawable/ic_baseline_add_24" /> No

Styling android button

If you want to style android button with custom style with background, custom font different enable disable state button colors you can do that using providing custom style to your button below is the example: inside res/value folder 1st. style for the button  <style name =“CustomButtonStyle” parent ="Widget.AppCompat.Button" >     <item name ="android:background" > @drawable/button_background.xml </item>     <item name ="android:textSize" > 16sp </item>     <item name ="android:textColor" > @color/black </item>     <item name ="android:fontFamily" > @font/font_name </item>     <item name ="fontFamily" > @font/font_name </item>     <item name ="textAllCaps" > false </item> </style> 2nd. in background we are supplying selector so we can have different enable / disable state background and text colors button_background.xml <? xml ver