FAB Shadow sample for http://androiduiux.com/2015/07/22/make-the-right-fab/
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<!-- | |
The FAB widget inflates a default style which is available in | |
/sdk/extras/android/support/design/res/values. As per Material Design | |
guidelines, the FAB elevation is 6dp instead of the preset 8dp value. | |
Other default FAB values are correct with respect to the specs. | |
Thus to get the correct FAB, we only need to override app:elevation. | |
NOTE: it is app:elevation and NOT the API 21+ android:elevation. | |
NOTE2 : This FAB is not assigned any icon, just a solid colorAccent FAB | |
--> | |
<android.support.design.widget.FloatingActionButton | |
android:id="@+id/fab" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
app:elevation="6dp" /> | |
</FrameLayout> |
<resources> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<item name="colorPrimary">@color/color_primary</item> | |
<item name="colorPrimaryDark">@color/color_primary_dark</item> | |
<item name="colorAccent">@color/color_accent</item> | |
<item name="android:windowBackground">@android:color/white</item> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment